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 every few minutes/hours/days I do a serious commit with a real comment like, "Fixed bug #22.55, 3rd time." How can I separate these two concepts? I would like to be able to remove all my frequent-commits and just leave the serious ones.
Using Squash Instead
Recently, I've been working in another branch and using squash
. The other branch is called temp, and then I use git merge temp --squash
to bring it into the real branch that gets pushed to the server.
Workflow is something like this, assuming I'm working in Ticket65252
:
git branch -d temp #remove old temp bbranch
git checkout -b temp
# work work work, committing all the way
git checkout Ticket65252
git merge temp --squash
git commit -m "Some message here"
Advantages over using rebase
? Way less complicated.
Advantages over using reset --hard
and then reset --soft
? Less confusing and slightly less error prone.