Work on a pull request on a master update

I'm working on my branch, but then I have a pull request from someone else that I had to merge with master

.

After merging the pull request into, master

I was unable to merge my branch dev

into master

! So, I did this:

git fetch && git rebase origin/master && git pull && git push

      

Then my branch git log

looked like this:

  • My branch is ending.
  • Another participant is signing up.
  • My branch commits (from point 1), they repeat.

What am I doing wrong? How can I avoid this problem? How do I fix the mess I've created in mine git log

? This git log

makes everything mine look terrible ..

+3


source to share


1 answer


It depends on your goal. You have 2 options:

  • If you want to rebase your branch - replace the existing commits on that branch with new ones starting from origin/master

    , then you won't need it git pull

    in your team. Then, git push -f

    or maybe create a new branch from that point and just git push

    . This will result in: (in order)

    • old master story
    • new master changes
    • your branch commits
  • If you want to keep the commits and add the merge point using the wizard, you can replace these commands with git checkout your_branch ; git fetch ; git merge origin/master

    . You will be solving the same conflicts as when trying to merge your branch with the master. But on the other hand, these are the same conflicts that you have to deal with when you reboot. This will result in: (in order)

    • old master story
    • your branch commits
    • merge with new major changes


How to fix this, you can find your branch in git reflog

. Take a look at the commit before you reinstall and branch it out of it. You have the choice to either start a new branch this way, or dump the old branch before this commit.

+4


source







All Articles