Last active
March 19, 2020 10:28
-
-
Save b2977053/d370c40237fe42752ca204137e3406ae 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-rebase-demo | |
cd git-rebase-demo | |
git init | |
# 新增檔案 a.txt、b.txt 並分別提交。 | |
echo 'a.txt first commit' > a.txt | |
git add . | |
git commit -m 'a.txt first commit' | |
echo 'b.txt first commit' > b.txt | |
git add . | |
git commit -m 'b.txt first commit' | |
# 新增分支 branch_1 | |
git checkout -b branch_1 | |
# 新增檔案 C.txt、D.txt 並分別提交。 | |
echo 'C.txt first commit' > C.txt | |
git add . | |
git commit -m 'C.txt first commit' | |
echo 'D.txt first commit' > D.txt | |
git add . | |
git commit -m 'D.txt first commit' | |
# 回 master 繼續新增 E.txt | |
git checkout master | |
echo 'E.txt first commit' > E.txt | |
git add . | |
git commit -m 'E.txt first commit' | |
git reflog | |
# | |
# 插入 | |
# reword | |
# | |
git checkout branch_1 | |
git rebase <SHA-1> -i | |
. | |
. pick -> edit | |
. | |
git log --oneline | |
echo 'C.txt first commit Edit' > C.txt | |
git add . | |
git commit -m 'C.txt modify' | |
git log --oneline | |
git rebase --continue | |
git log --oneline |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment