I have created remote branch name REMOTE1 and made changes and updated the REMOTE1. Similarly my colleagues have worked on MASTER and made considerable amount of changes.
Now I have to merge the changes from remote/MASTER to remote/REMOTE1.
Can anyone help me with the best workflow to follow in this case. I have tried following steps
git checkout master
git pull
git checkout REMOTE1
git rebase master
So many merge conflicts and I have resolved them ...
when I try git status
# On branch REMOTE1
# Your branch and 'origin/REMOTE1' have diverged,
# and have 16 and 10 different commit(s) each, respectively.
#
I am not sure what it means ???
Then I try to PUSH into my remote branch REMOTE1 and I get following error
! [rejected] HEAD -> REMOTE1 (non-fast-forward)
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes before pushing again. See the 'Note about
fast-forwards' section of 'git push --help' for details.
Before any rebase operation
--- A - B - C - D MASTER
\
P - Q - R REMOTE1
After doing the steps mentioned above
MASTER LOCAL REMOTE1
| |
--- A - B - C - D - P - Q - R
\
P - Q - R REMOTE1
Looks like you are trying to push REMOTE1 with different changes than the ones that are on origin/REMOTE1. Before doing this, try to pull REMOTE1. First, check it out:
git checkout REMOTE1
Now, while on REMOTE1, pull the changes from origin:
git pull origin REMOTE1
Now you have local REMOTE1 synchronized with origin/REMOTE1. You can rebase changes from master and push:
git checkout master
git rebase REMOTE1
git checkout REMOTE1
git push origin REMOTE1
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