Skip to content

Instantly share code, notes, and snippets.

@b2977053
Created March 19, 2020 10:36
Show Gist options
  • Save b2977053/e9489bb3c9284930e3f4d431f82f46d7 to your computer and use it in GitHub Desktop.
Save b2977053/e9489bb3c9284930e3f4d431f82f46d7 to your computer and use it in GitHub Desktop.
# 建立資料夾 與 版本庫
mkdir git-rebase-demo
cd git-rebase-demo
git init
# 新增檔案 a.txt ~ D.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'
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'
git log --oneline
#
# 壓縮
# squash or fixup
#
git rebase <SHA-1> -i
.
. pick -> squash or fixup
.
git log oneline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment