I check my code into a Git branch every few minutes or so, and the comments end up being things like \"Everything broken starting again\" and other absurdities.
Then
Using Soft Reset Instead of Rebase to Squash GIT History
I think the length of VonC's answers speaks volumes -- literally -- about how complicated git rebase
is. This is my extension of another answer to a question of mine.
ticket-201
that you branched from master
. You want to pretend that all the commits from ticket-201
never happened, but that you did all the work in one shot.git reset --soft hash
where hash
should be a commit hash that is in ticket-201
's log.Making Up Histories From Arbitrary Commits in Different Branches
Using resets you can rewrite the history as you see fit, though your edits will lose the charm of having the right timestamp. Assuming you don't care about that (the times/dates on your files will be enough, perhaps?), or if you want to fiddle with the commits as you go, you can follow these steps:
commit0
(pretend that's a hash): git checkout -b new-history commit0
commit5
: git reset --hard commit5
git reset --soft commit0
This idea is simple, effective and flexible.