git commit withdraw

需求

  • undo last commit in local git.

refer

命令行

  • HEAD~1 means that you will move you head to last one commit you made before in log history.

git reset --soft HEAD~1

git log --oneline

实践

$ git log --oneline

  • 原来的 git log history
  • 希望撤回 35966ce 那条 commit

Copy Code

# 返回
35966ce pol ch5 update
1811c51 get all week issue comments and cut into list
f47023e make a dict
eaaed7e iscmt-get-alwk

$ git log --oneline

  • 35966ce 那条 commit 被撤回

Copy Code

# 返回
1811c51 get all week issue comments and cut into list
f47023e make a dict
eaaed7e iscmt-get-alwk
7d3cc16 get int from issue comment str

changelog

  • 2020.10.02 init