Note that there are some explanatory texts on larger screens.

plurals
  1. POcan't push to branch after rebase
    primarykey
    data
    text
    <p>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.</p> <p>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.</p> <p>question: after rebase and conflict resolution, how do I sync up my local and remote developer branches without creating duplicate commits</p> <p>Setup:</p> <pre><code>// 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 </code></pre> <h2>EDIT</h2> <p><strong>So it sounds like this will break the workflow:</strong></p> <p>developer1 working on myNewFeature developer2 working on hisNewFeature both use master as main branch</p> <p>developer2 merges myNewFeature into hisNewFeature</p> <p>developer1 rebases, resolves conflicts, then force pushes to remote branch for myNewFeature</p> <p>a couple days later, developer2, merges myNewFeature into hisNewFeature again</p> <p>Will this cause the other developers to hate developer1?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload