git version revoked, rewind, etc.

  1. git checkout - <file> # discard modify the workspace, not to omit - this is only to modify the content in the workspace (work tree), not add to the staging area at this time want to undo changes on the use of this. command
  2. git reset head <file> # to modify the staging area off of revocation (unstage), back into the workspace; then if you want to revoke away from the work area, on the implementation of git checkout - <file> to
  3. git reset --hard target version to the target version number # revoked or withdrawn to a particular submission, as if to use git push -f strong push up
  4. git revert -n version # undo a commit, the difference between the two of them is: Suppose there are three versions, `git reset --hard version of the index` 1 revocation to version 1, then version 2 and 3 are not, and use `git revert -n version two` revocation, version 2, 3 are retained, there will be a new version 4, this version is retained 1,3 and the contents of version 2 removed.

Guess you like

Origin www.cnblogs.com/bneglect/p/11434319.html