Josh Walker
Josh Walker

Reputation: 51

How to rebase all the commits?

How to rebase all the commits?

Upvotes: 0

Views: 530

Answers (2)

Marina Liu
Marina Liu

Reputation: 38096

You can use git rebase --onto to rebase each branch separately (the intial commit should preserved).

Such as you have commit A~H in master branch, now you can remove commits B~G by the commands:

A---B---C---D---E----F---G---H master

git checkout master
git rebase --onto commitA commitG master

Then master branch will look like:

A---H master

You can use the same way for other branches.

Upvotes: 0

Vampire
Vampire

Reputation: 38639

Use git filter-branch with an --env-filter where you recalculate the GIT_AUTHOR_DATE and / or GIT_COMMITTER_DATE environment variables.

Upvotes: 1

Related Questions