GitbookIO / gitbook

The open source frontend for GitBook doc sites
https://www.gitbook.com
GNU General Public License v3.0
27.22k stars 3.88k forks source link

Changing a page in GitBook is not visible in the files of the gitrepo locally #1183

Closed andywenk closed 7 months ago

andywenk commented 8 years ago

Hi there,

first of all thanks a lot for creating GitBook. I really can't wind my head around this thing. Here are the steps I did:

This reads like a newbie wrote some explanation and that's per intention. I am very familar with git and understood, that GitBook is creating automatic commits, when a page is saved. But why do I not see the changes in the physical file. This is very confusing for me and I do not understand the concept.

User Stories:

"As an editor I want to change or add files (.md, .jpg and so on) at the physical location of the used git repository for GitBook. I want to see these changes immediately in the GitBook editor."

"As an editor I want to change or add files (.md, .jpg and so on) in the GitBook editor and see these changes immediately in the used git repository."

Do I miss something here?

Thanks and all the best

Andy

nagim commented 8 years ago

Hi,

Whether or not GitBook Editor commits your changes automatically on saving depends on your settings. Check in the editor settings if automatic commits are enabled. If not, you have to commit manually after saving. You can add/remove files from the editor itself. In the file tree view, right click and choose upload files or upload folders. Guess if you copy the files to the folder outside the editor, you need to run a git add manually after.

Cheers, Imre

andywenk commented 8 years ago

@nagim,

thanks for your answer. I am aware how to add files inside the editor. But as I described and as you mentioned in the second part of your comment, I am not able to understand, how to add files outside the editor - means directly in the repo locally.

What I am faced with now, is to figure out, where GitBook is placing the files on my local HD. To circumvent all these hassles, I have created a book on gitbook.com and cloned it. Added all the stuff I need (I am at the beginning, so no problem) and pushed it. Everything is fine. BUT - where can I see in GitBook where the files are placed locally. I have a guess, because a new directory was created (I changed the settings for GitBook). But the files there are not corresponding with what I see in the editor.

Sorry, but this is really strange. I am mostly working on the command line so if the result of what I see is different to what I expect is breaking my brain ;-)

Thanks for further hints. If this behaviour is considered a bug, I am happy to open a new issue with a consolidated description.

Cheers

Andy

EDIT:

I have finally found the checked out files. They are somehow cached or something. No idea. But changing a file directly in the repo, saving it and git adding it will not be visible in the editor. Even worse, when I sync in the editor, the changes are unstaged and revoked (!?). But changing a file locally, adding it and commiting it will finally also be visible in the GitBook editor.

Imho - this behaviour is a bug. I am not sure how "sync" is implemented (I guess it is a git pull) but it should definitely not erase changes I already added locally. This behaviour does collide with the git idea. It should create a conflict that has to be resolved.

kentf commented 8 years ago

So much this.

I sometimes use Notepad++ (or other editors). When opening the Gitbook Editor, I don't want previous work to be erased/unstaged without any warning. Even code files (cpp/hpp) are reverted!

This is very bad, and is a deal breaking "feature".

abeolson commented 8 years ago

Just getting started using gitbook editor and ran across this behavior. Gitbook editor has a bad functionality (inconsistent with other editors I have ever used) and should be fixed.

User story

  1. If I open a local file (with any editor) and click "save", I expect that the changes are saved to the local file.
  2. If I want to sync to a version control repository. I click "sync", and I expect that the changes will be saved both to the local file and the repo.
jluna79 commented 8 years ago

+1

Here's a screenshot of the bug:

screenshot 2016-05-27 19 04 09

This is a really annoying behaviour (bug) on a really useful and otherwise really nice tool!

ztl8702 commented 8 years ago

+1 for this bug to be fixed.

Spiralis commented 8 years ago

Are no-one working on this for the moment??

IMHO this is so bad that I cannot understand how it was released as a stable version. This was driving me crazy, until I found this post (and #1145).

Like @kentf mentioned, this also seems to affect non-gitbook files. It actually just seems like it reverts to the latest commit in the repo. I cannot understand how on earth anyone thought that that was a good idea?

SamyPesse commented 8 years ago

@Spiralis I understand the frustration here. It's the result of an early technical decision to work with the GIT API.

The GitBook Editor only works with files in the GIT history. We are working on fixing this ( https://github.com/GitbookIO/feedback/issues/101).

Spiralis commented 8 years ago

Thanks @SamyPesse. I am very happy to hear that this is being addressed 😄 👍