We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
重新梳理历史(Rewrite History!)
amend可以快速且快捷地对前一个commit增加改动(changes)。
Rebase = give a commit a new parent
git rebase -i <commit_to_fix>^
编辑一个commit可以将其分割成多个commit:
git reset HEAD^
git add
git commit
git rebase --continue
当需要对任意一个commit进行修补时,
git add new files
git commit --fixup <SHA>
git rebase -i --autosquash <SHA>^
git rebase -i -exec "run-test" <commit>
exec有两个选项:
在rebase进行完成时,如果发现哪里不对,可以通过以下命令还原:
git rebase --abort
在进行rebase/fixup/squash/reorder之前:
备份当前的分支:
git branch my_branch_backup
如果rebase“成功”了,但是弄错了...,通过以下命令回到初始状态
git reset my_branch_backup --hard
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Rebase,Amend
重新梳理历史(Rewrite History!)
AMEND A COMMIT
amend可以快速且快捷地对前一个commit增加改动(changes)。
COMMIT CAN'T BE EDITED
WHAT IS REBASE ANYWAY?
Rebase = give a commit a new parent
REBASE: REWINDING HEAD
REBASE: APPLY NEW COMMITS
MERGE VS REBASE
INTERACTIVE REBASE (REBASE -I OR REBASE --INTERACTIVE)
git rebase -i <commit_to_fix>^
REBASE OPTIONS
REBASE EXAMPLE
TIP: USE REBASE TO SPLIT COMMIT
编辑一个commit可以将其分割成多个commit:
git reset HEAD^
git add
git commit
git rebase --continue
TIP: "AMEND" ANY COMMIT WITH FIXUP & AUTOSQUASH
当需要对任意一个commit进行修补时,
git add new files
git commit --fixup <SHA>
git rebase -i --autosquash <SHA>^
FIXUP & AUTOSQUASH EXAMPLE
REBASE --EXEC(EXCUATE A COMMAND)
git rebase -i -exec "run-test" <commit>
exec有两个选项:
PULL THE RIP CORD
在rebase进行完成时,如果发现哪里不对,可以通过以下命令还原:
git rebase --abort
REBASE PRO TIP
在进行rebase/fixup/squash/reorder之前:
备份当前的分支:
git branch my_branch_backup
如果rebase“成功”了,但是弄错了...,通过以下命令回到初始状态
git reset my_branch_backup --hard
REBASE ADVANTAGES
COMMIT EARLY & OFTEN VS GOOD COMMITS
WARNING: NEVER REWRITE PUBLIC HISTORY
The text was updated successfully, but these errors were encountered: