DEV Community

Waylon Walker
Waylon Walker

Posted on • Originally published at waylonwalker.com

Git rebase to the beginning of time

Git has a built in way to rebase all the way back to the beginning of time. There is no need to scroll through the log to find the first hash, or find the total number of commits. Just use --root

git rebase --root
Enter fullscreen mode Exit fullscreen mode

Top comments (3)

Collapse
 
aerabi profile image
Mohammad-Ali A'RÂBI

Jeez! In the case of an interactive rebase, you probably have to edit the TODO file for hours. :D

Collapse
 
amye profile image
Amy Elliott

What does rebase mean? Is it a dangerous command? does it 'push' anything?

Collapse
 
aerabi profile image
Mohammad-Ali A'RÂBI

Rebase is changing history, and is usually used when you want to put your feature branch ahead of the master branch. It doesn't push anything automatically, you should do it manually afterward.

Maybe this podcast episode might be helpful.