Change Git Obligation to Common Repo

I have a local git repository that I recently committed and then switched to a shared repo. Only after I pushed him to the general repo did I realize that I had made an ugly mistake. I fixed it locally with no problems after I fixed my source:

git commit -C HEAD -a --amend

After that, I tried another git push start and got the following error:

! [rejected]        mybranch -> mybranch (non-fast forward)

What is the best way to fix this?

+5
source share
5 answers

git (by default) does not allow you to click on a branch that rewinds the tip of the branch. In other words, if the current branch is not the direct parent or ancestor of the branch tip, then the click will be rejected.

-f git push refspec "+", . git push origin +mybranch:mybranch.

, , , , .

, receive.denyNonFastForwards ( , ).

, , .

.

git push origin :mybranch
git push origin mybranch

, git receive.denyDeletes, , , .

+7

, ... ehm... --force push.

.

+5

, , . , , , HEAD, .

+2

, , , :

git push origin +mybranch
0

git reset?

-2

All Articles