Git如何撤销一个提交,并重新push
背景
在git上push了一个错误的信息和文件,需要撤销,公司使用Gerrit来自动化处理提交信息。
Gerrit 撤销提交
Gerrit提交信息中点击abandon
本地撤销
git git reset --soft HEAD~1
该命令,取消刚才的push,并保留暂存区(注意,只是本地,远程仓库的提交信息不会消失)
取消其中的一个暂存
git reset HEAD XunGallery/app/libs/framework.jar
取消其中的一个add
重新提交
git add [修改文件]
git commit -m "info"
git push origin

浙公网安备 33010602011771号