Cjku/git: Difference between revisions

29 bytes removed ,  29 October 2014
Line 377: Line 377:
# <span style="color:red">(Different with git-reset)</span> Change the referee(branch) of HEAD.
# <span style="color:red">(Different with git-reset)</span> Change the referee(branch) of HEAD.
# <span style="color:red">(Different with git-reset)</span> There is no hardness-choice in git-checkout. git-checkout always modifies working directory and the index.  
# <span style="color:red">(Different with git-reset)</span> There is no hardness-choice in git-checkout. git-checkout always modifies working directory and the index.  
# <span style="color:red">(Similar to git-reset-hard)</span> Regenerate index according to the tree of the new assigned commit; Overwrite all '''modified''' tracked files in working directory. The only difference between git-reset-hard and git-checkout is git-reset-hard never aborting, while git-checkout will.(Note: A file in working directory will be overwritten only if it's a tracked one and the content of that file in tree is different between two branches. Unchanged files and untracked files are out of scope. checkout-aborting has direct relation with this principle).
# <span style="color:red">(Similar to git-reset-hard)</span> Regenerates index according to the tree of the new assigned commit; update working by the index. There are two place that git-reset-hard differs from git-checkout. The first one is git-reset-hard never aborting, while git-checkout will. Second, git-reset-hard simply overwrites all dirty tracked files from the tree; git-checkout, in other hand, does not care about whether a tracked file is dirty. git-checkout overwrites tracked files which content are different in origin and new tree.


Scott Chacon/Ben Straub wrote a fantastic article with regards to reset, and deserves you spend time on: http://git-scm.com/blog/2011/07/11/reset.html
Scott Chacon/Ben Straub wrote a fantastic article with regards to reset, and deserves you spend time on: http://git-scm.com/blog/2011/07/11/reset.html
Confirmed users
1,643

edits