git command(1)

Revoke Operation

1
git checkout -- [file]
  • When file just in work area conduct modify, Not yet(还没有) commit to temporary(暂存) storage.
    You can use this command, To achieve effect(来达到效果)
1
git reset HEAD
  • If you in work area conduct the modify, And commit to temporary. `git checkout – [file]` command
    it’s invalid(就无效了).
    This time should use `git reset HEAD` command to achieve effect.

    1
    git checkout HEAD [file]
  • This command just will two on the top combine(组合起来), Direct use HEAD cover(覆盖) temporary and
    word area.

Rollback Version

1
git reset --hard HEAD~n
  • In git `HEAD` express current version. This command just rollback to `~` after appoint version.

    1
    git reset --hard commit_id
  • This command just rollback to `commitid` version.
    In git see commitid the method: git reflog command.

Delete Summary

1
git rm
  • This command will delete word area and temporary in content.

  • If delete file after, Want to get back(想要找回) just got us(刚刚被我们) delete the file.Use `git checkout HEAD [file]` command to achieve effect. Permise is(前提是) not commit.

  • If delete file after and commit, Then you need use `git reset –hard HEAD~1` rollback
    to one on top version, Can achieve effect(可以达到效果).