Skip to content

一些会用到,但记不住的git命令

  • 将本次提交合并到上次提交
bash
git commit --amend --no-edit
  • 合并多次提交
bash
git rebase -i [commit id]
  • 将其他分支合并到当前分支(所有更改皆为其他分支的更改)
bash
git rebase [合并分支] -s recursive -X theirs
  • 列出所有分支,本地和远程
bash
git branch -av

注意

s 合并到

如果有冲突

bash
git add .
git rebase --continue

取消变基

bash
git rebase --abort
  • 强制推送
bash
git push -f origin master