What's the difference between Git add (ctrl+A) and Stage to Commit (ctrl+T) in the git GUI?

你。 提交于 2020-01-24 09:36:25

问题


If git add CTRL+A starts tracking changes AND stages changes to already tracked files, why should I ever use Stage to Commit CTRL+T in the git gui ?


回答1:


Here's the answer to my question: CTRL+A in the GIT GUI is actually to ADD A NEW REMOTE and is not the same as GIT ADD ! In the GIT GUI, there does not seem to be any distinction between 'adding' and 'staging' , both are done by the 'stage to Commit' command: CTRL+T. And according to this: http://hoth.entp.com/2008/11/5/what-git-add-really-means , 'git stage' is an alias for 'git add'

Thanks aardvarkk for your answer. I suppose 'adding' can be considered the 'first staging' of a file, but really 'adding' means 'adding to the stage' or 'staging to commit'.

Concisely,
CTRL+T = 'stage to commit' in the GIT GUI = 'git add' at the command line
CTRL+A = add a new remote




回答2:


Stage to Commit would be for a file that already has changes being tracked which you've since altered. You would generally only "add" a file once to begin tracking changes, and thereafter you would simply stage the file for commit that you've changed.




回答3:


According to git documentation, they are synonyms. The command prepares the files for commit.

Example: git add app_controller.php



来源:https://stackoverflow.com/questions/9929691/whats-the-difference-between-git-add-ctrla-and-stage-to-commit-ctrlt-in-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!