1

I feel like there must be a simple answer for this...

I can get a coalesced diff of changes on a branch. git diff somecommit..latestcommit. Easy enough.

I can rebase a branch onto a different branch. git rebase -i updatedbranch rebasedbranch. Simple.

With interactive mode, I can even squash that down into one commit.

But I can't get both to happen at once. I can't get the coalesced diff to be used for the rebase. It wants to apply every commit, one by one. There's like 50 of them, and every time I'm going through git mergetool and making the same choices, 50 times in a row. The coalesced diff is something like 2500 lines. We're talking about a lot of work here. There must be an easier way.

What I'm trying to do: get the coalesced changes applied between two commits on one branch (like git diff a..b), and replay those changes on another branch.

Any help appreciated.

Morgan Harris
  • 2,589
  • 14
  • 17

1 Answers1

2

TIL: git apply. Seriously, git is a bottomless pit of functions.

For others:

git diff a..b > ab.diff
git checkout otherbranch
git apply ab.diff

Easy.

Morgan Harris
  • 2,589
  • 14
  • 17
  • [Squash-merging](http://stackoverflow.com/questions/5308816/how-to-use-git-merge-squash) might be even slightly easier; especially for people who are affraid of patches and `git apply` ;) – Nevik Rehnel Sep 26 '13 at 06:34