I know how to sync branch with master. I do this so:
git checkout target-branch
git merge master
# resolve conflicts if any and commit
git push
I am trying to figure it out what BitBucket suggests me when automatic sync failed because of conflicts. BitBucket suggests me:
git checkout 326907c583f7
# Note: This will create a detached head!
git merge remotes/origin/master
What's the point to create detached head? I does not make sense to me. Is it bug on Bitbucket side or I am missing something?
In case BitBucket can't sync branches for you, that you have some conflicts with your branch changes and the destination branch.
You can use git rebase
to sync your local branch and later, push changes.
Assuming that you want to sync with the master
branch, you can do these next steps:
First, update your local master
branch.
git fetch origin master:master
Then, sync changes of your branch with the master
branch
git rebase master
If you have conflicts, you will receive a message with more information about them. Make the necessary changes and use:
git rebase --continue
There you can receive a new conflict, in that case, repeat the previous operation. If not, you can push changes to the remote repository.
Cause you have changes the history with the git rebase
command, you will need to force your push.
git push -f
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With