git cherry-pick git rebase git revert 基本应用

145 阅读1分钟

首先附上一个git练习网址 https://learngitbranching.js.org/?locale=zh_CN

4c97ff3 操作id

// 复制其他分支内容到当前分支
git cherry-pick 4c97ff3

// 合并已经push的commit信息
git rebase -i 4c97ff3
pick-->f (或者s)
git push -f

// 回退已经push的提交记录
git revert HEAD~1

// 把修改内容合并到上次提交
git commit --amend
git push -f

// 删除本地代码修改
git reset --hard