问题描述
所以,我的情况是(错误地)我已经允许一个人提交给我的分支。现在在我的本地我做了一个提交,当我试图将它推送到远程时,它显示远程遥遥领先。因为其他人已经用几次提交将他的代码推送到这个分支。现在,我可以从远程删除那些提交而不需要拉到我的本地吗?我试图做到这一点 git push origin +<<提交编号>> ^:分支
但它表示 src refspec<< commit number>> ^不匹配任何。
请试试这个
git push origin<< branch_name>> -f
如果使用 -f
for force push
这将删除其他人提交的提交。
So, my situation is (by mistake) I have given access to a person to commit to my branch. Now in my local I have made a commit and when I tried to push it to the remote it shows that the remote is ahead. Because the other person has pushed his code to this branch with several commits. Now, can I remove those commits from remote without taking pull to my local?
I tried to do this git push origin +<<commit number>>^:branch
But it says src refspec <<commit number>>^ does not match any.
Please try this
git push origin <<branch_name>> -f
In this -f
if used for force push
This will remove commits that are made by someone else.
这篇关于Git删除其他人的远程提交的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!