I am usually fairly capable when it comes to Git but I am not so sure what happened in this scenario, and what would be the best solution.
Scenario:
- I created a feature branch off of dev.
- Fix completed, tested and pushed.
- I then switch back to dev, do
git pulland see several commits from my team mates. git checkout featureBranchfollowed bygit rebase devto replay my changes over the latest dev (as I understand it).git statussays that local and origin featureBranch have divergedgit pullis required.git pullresults in a commit message terminal opening.git statusshowsgit pushis required.- After
git push, my PR shows all of the commits from my co-workers from dev on my branch, not just the fix.
What did I do wrong in this case? I wanted to stay working on my featureBranch in isolation until it was fixed, and at that point, make sure my changes were applied to the latest dev to avoid conflicts. In this case my team encourages rebase.
Why are the new commits from dev showing in my PR featureBranch >> dev when they are already on dev?
What would be the best solution to bring my PR back to the 1 original commit? I don't mean squash here, I mean the dev commits should not be here.