0

I have the following branch structure.

o---o (develop)
     \
      o---o---o---o (feature-1)
                   \
                    o---o (feature-2)

I'd like both feature-1 & feature-2,
to be up to date with develop using rebase, not merge.


Typically when working on 1 branch,
I'll just do the following:

git fetch
git rebase origin/develop
git push --force-with-lease

How do I do this same kind of rebasing,
so that both feature-1 and feature-2 are fully up-to-date with develop?

Riveascore
  • 1,724
  • 4
  • 26
  • 46
  • The easiest way of doing so is, once the feature-1 branch is updated (rebased), `git checkout feature-2`, `git rebase feature-1`, verify the rebase using quick `git-status` and `git-log --graph` (optionally by running tests), `git push --for-with-lease`. It's kind of tedious, but not really. I implemented a bash script (then a Python reimplementation) that detects "branch families" by using `git-show-branch` (not by using git plumbing commands, though, yep), and then rebases all of those in proper order. However, I stopped using that script because now I prefer using native commands. – terrorrussia-keeps-killing Apr 28 '22 at 05:06
  • (re-posted the previous comment since I cannot edit it any longer) If you had conflicts during the rebase "origin/develop <- feature-1", then you might need to use interactive rebase for the feature-2 branch in order to `drop` commits that previously caused conflicts and were not originally implemented on the feature-2 branch. Or, if you remember the exact number of commits on the feature-2 branch, then you can have a look on various git-rebase parameter overloads that would also be able to discard potentially conflicting commits from now-upstream branch feature-1. – terrorrussia-keeps-killing Apr 28 '22 at 14:46
  • Where do you encounter problems? `git rebase develop branch` should work just fine – knittl Oct 23 '22 at 17:24

0 Answers0