2

I am using Git Extensions as add-in in Visual Studio 2010. It is working great. However, whenever I am going to commit to repository, the GUI forces me to manually select the appropriate files for adding to the stage (even if these files has been indexed and added to the stage already). I am a little bit confused since my believe was that already staged files do not require a selection for the stage again.

Example: In the Git Extension's GUI, I am adding Network.cpp to the stage after using Commit. In the next, I type any arbitrary but useful description and commit the staged files. The next time the Network.cpp has been changed, I have to stage Network.cpp again after committing to repository.

Is there anything completely wrong in my workflow?

Thanks in advance for your help.

4

1 回答 1

3

Nothing is wrong with your workflow; you're running into the same misunderstanding of the staging area (the "index") that most people have at first.

With Subversion and Mercurial, once you've told the system to track a file, it checks for changes in that file every time you commit. Any changes to a tracked file get noticed automatically.

Git is different. With Git, you don't add files to the staging area, you add changes to files. This means each time you change a file, you need to add those changes if you want them included with the next commit. If you don't add new changes to the staging area, they never get committed.

Usually you want to commit everything that's been changed, so with Git Extensions just use the "Stage All" button each time you commit, and you'll see the system behave pretty much the same way that Subversion and Mercurial do. If you use the command line, you can use git commit -a to automatically add changes that have been made to tracked files.

于 2012-07-15T08:55:25.150 回答