Merge a branch with a non-updatable master

Question

I combined the branch into a master that was not updated at the last moment.

What am I doing

I merged the branch in master

git merged BRANCHNAME

Conflicts

Automatic merge failed; fix conflicts and then commit the result.

git commit -a -m "Resolved conflicts while merging email-fix branch"

Then I tried to push everything into the original master, but it says:

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

How can I solve this problem?

+3
source share
1 answer

You can do:

  • a git pull --rebaseto reproduce your merge on top of a modern leading branch
  • then a git push(which should go smoothly)

Another alternative would be to force click, which would mean the loss of recent history on the remote host: not a good idea.

Git , git pull.
git push git pull --rebase:

, , - commit X, , B, , A. :

      B
     /
 ---X---A

X B A, "git pull --rebase" . rebase commit D, X B A.

      B   D
     /   /
 ---X---A

, A , push .

+1

Source: https://habr.com/ru/post/1771911/


All Articles