Roy Lee
Roy Lee

Reputation: 10842

Rebase interactively all commits under feature branch

Using ref HEAD, you could select as many last commits:

git rebase -i HEAD~2


Now, let's say there are 30 commits under a feature branch: feat/xyz, you could easily count the number of commits and git rebase -i HEAD~30

Question: Is there a way to select every commits of that branch without counting them?

Upvotes: 1

Views: 62

Answers (1)

merlin2011
merlin2011

Reputation: 75545

If you know which branch you branched off of (e.g. master), you can use merge-base to find the common ancestor.

git rebase -i $(git merge-base HEAD master)

Upvotes: 4

Related Questions