Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rebase all the commits from the beginning

Tags:

git

github

So I'm migrating from svn (code.google.com) to git(github).

I've imported my project from the svn repo, and it imported all the commit history along way. I'm not really proud of those comments as it was one of my first project, not really serious.

I'd like to rebase everything into a single 'initial import' commit.

I've pulled everything on my computer and I'm trying to do that. But all I found was: git rebase -i master but it only rebases new modifications and commits.

How can I clean my github repository from all history with a rebase?

like image 402
plus- Avatar asked Dec 22 '11 14:12

plus-


People also ask

How do I rebase all my commits?

To rebase, make sure you have all the commits you want in the rebase in your master branch. Check out the branch you want to rebase and type git rebase master (where master is the branch you want to rebase on).

How do you squash all the commits?

Squashing by Interactive Rebase. Git's interactive rebase will list all relevant commits in the default editor. In this case, those are the commits we want to squash. Then we can control each commit and commit message as we want and save the change in the editor.

What is git rebase all?

What is git rebase? Rebasing is the process of moving or combining a sequence of commits to a new base commit. Rebasing is most useful and easily visualized in the context of a feature branching workflow.

Can I reorder commits with rebase?

Interactive Rebase also allows you to reorder commits. Simply drag and drop a commit between two existing commits to reorder history.


1 Answers

git rebase -i --root will start an interactive rebase of all commits from the beginning.

From there, you can squash all commits into one and/or perform other edits.

like image 95
Tobias J Avatar answered Nov 26 '22 06:11

Tobias J