Wrong revert in git
I wanted to revert the last push on branch branch1
and I used this command when I was on branch1
:
git push -f origin HEAD^:master
and instead of writing git push -f origin HEAD^:branch1
. The result is that my master become branch1
. Now I want to bring back my old master
. Can I do that?
This answer assumes your local master
branch was upto date with origin/master
.
Yes, you can force push local master on the remote master again:
git push -f origin master:master
You don't need to be explicit on to what you are pushing here, because git will assume same name branches, so you can shorten it to:
git push -f origin master
链接地址: http://www.djcxy.com/p/18864.html
上一篇: Git:检查以前的提交并放在顶部?
下一篇: 错误的恢复在混帐