先reset到ahead,然后退回到分叉,再checkout 遠端的behind
git commit -n、如果要刪除本地的commit, 先到本地的最前端, 然后再用下面的命令
If you want to fix up your latest commit, you can undo the commit, and
unstage the files in it, by doing:git reset HEAD~1 This will return your repository to its state before
the git add commands that staged the files. Your changes will be in
your working directory. HEAD~1 refers to the commit below the current
tip of the branch.If you want to uncommit N commits, but keep the code changes in your
working directory:git reset HEAD~N If you want to get rid of your latest commit, and do
not want to keep the code changes, you can do a “hard” reset.git reset –hard HEAD~1 Likewise, if you want to discard the last N
commits, and do not want to keep the code changes:git reset –hard HEAD~N
2.刪除遠端commit
先退回到正確的local commit然后
git push –force
版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。
工作时间:8:00-18:00
客服电话
电子邮件
admin@qq.com
扫码二维码
获取最新动态