We use git and have a master branch and developer branches. I need to add a new feature and then rebase the commits to master, then push master to CI server.
The problem is that if I have conflicts during rebase I cannot push to my remote developer branch (on Github) after the rebase is complete, until I pull my remote branch. This causes duplicate commits. When there are no conflicts, works as expected.
question: after rebase and conflict resolution, how do I sync up my local and remote developer branches without creating duplicate commits
Setup:
// master branch is the main branch
git checkout master
git checkout -b myNewFeature
// I will work on this at work and at home
git push origin myNewFeature
// work work work on myNewFeature
// master branch has been updated and will conflict with myNewFeature
git pull --rebase origin master
// we have conflicts
// solve conflict
git rebase --continue
//repeat until rebase is complete
git push origin myNewFeature
//ERROR
error: failed to push some refs to 'git@github.com:ariklevy/dropLocker.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull')
hint: before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
// do what git says and pull
git pull origin myNewFeature
git push origin myNewFeature
// Now I have duplicate commits on the remote branch myNewFeature
EDIT
So it sounds like this will break the workflow:
developer1 working on myNewFeature developer2 working on hisNewFeature both use master as main branch
developer2 merges myNewFeature into hisNewFeature
developer1 rebases, resolves conflicts, then force pushes to remote branch for myNewFeature
a couple days later, developer2, merges myNewFeature into hisNewFeature again
Will this cause the other developers to hate developer1?