Cjku/git: Difference between revisions

Jump to navigation Jump to search
33 bytes added ,  28 October 2014
Line 340: Line 340:
checkout a branch means
checkout a branch means
# <span style="color:red">(Different with reset)</span> Change the referee, which is a branch, of HEAD symbolic ref.
# <span style="color:red">(Different with reset)</span> Change the referee, which is a branch, of HEAD symbolic ref.
# <span style="color:red">(Similar to reset --hard)</span> Regenerate index according to the tree of the new assign commit object; Overwrite all tracked files in working directory. (Note: only tracked and dirty files will be overwritten by reset --hard. Unchanged files and untracked files are out of scope. checkout-aborting has direct relation with this principle). "reset --hard" is slight more powerful than "checkout", since it can access any commit while checkout can only access tip commit of the given branch, and more dangerous since it never abort.
# <span style="color:red">(Similar to reset --hard)</span> Regenerate index according to the tree of the new assign commit object; Overwrite all tracked files in working directory. (Note: only tracked and dirty files will be overwritten by reset --hard. Unchanged files and untracked files are out of scope. checkout-aborting has direct relation with this principle). "reset --hard" is slight more powerful than "checkout", since it can access any commit while checkout can only access tip commit of the given branch; On the other hand, "reset --hard" is more dangerous since it never abort.


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

Navigation menu