EvanK
EvanK

Reputation: 1072

git rebasing a branch against later master

Initially, I branched from master (A) and made a commit (B) on my feature branch...then merged in changes from master (C as D) and made another commit (E) using the changes from that merge:

-A--C
 \  \
  B--D--E

Now, I'd like to eliminate the merge commit itself (D) and clean up my branch's history by rebasing my entire branch against a later master (C):

-A--C
    \
    B--E

However, I am sufficiently confused about how to accomplish this.

Upvotes: 0

Views: 52

Answers (1)

eftshift0
eftshift0

Reputation: 30317

the "by hand" approach would be:

git checkout --detach C
git cherry-pick B
git cherry-pick E

Then you can set a branch over here:

git branch -f some-branch
git checkout some-branch

Upvotes: 1

Related Questions