Created
March 19, 2020 06:33
-
-
Save b2977053/d83388124241b6ccb3a8ef26836603ff to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 建立資料夾 | |
mkdir git-revert-demo | |
cd git-revert-demo | |
# 建立版本庫 | |
git init | |
# 新增檔案 a.txt 並提交。 | |
echo 'a.txt first commit' > a.txt | |
git add . | |
git commit -m 'a.txt first commit' | |
# 新增檔案 b.txt 並提交。 | |
echo 'b.txt first commit' > b.txt | |
git add . | |
git commit -m 'b.txt first commit' | |
# 查看 LOG | |
git log | |
# 將某個 commit 做相反動作 | |
git revert <commit ID> | |
# 查看 LOG | |
git log | |
# 將某個 commit 做相反動作,但沒有 commit | |
$ git revert -n <commit ID> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment