[Git] How to use git rebase

晚上10:37



Today, I am survey a git rebase method, then I want practice to change previous commit command. 
You can refer follow step to change...
How to change the previous commit:
  1. Use rebase to edit previous 3 commit
git rebase -i HEAD~3
  1. Open editor to edit the commit which you want to change
pick f37e150 xxxx
pick f15f439 xxxx
edit 647aab8 xxxx
  1. amend to your commit
git commit --amend
  1. After change your commit then continue rebase
git rebase --continue
  1. Done.
If you suffer follow error as your editor (default is ‘vi’), you can use follow command:
error: There was a problem with the editor 'vi'. Please supply the message using either -m or -F option.
git config --global core.editor /usr/bin/vi
[Reference]
  1. Git-工具-重寫歷史
  2. Change vi on mac os

You Might Also Like

0 意見