DISQUS

Phil Dawes' Stuff: Frequent code checkpointing with git

  • bartman · 2 years ago
    Have you tried using git-rebase -i ? You need to give it the commit id of the last commit before your string of changes. You can then tell it to combine all your commits into one (or more).

    # *hack*
    git commit -a -m"one"
    # *hack*
    git commit -a -m"two"
    git rebase -i HEAD~2
    # bring us an editor, select the "one" and "two" as squash, save, exit.
    git log

    An alternative workflow is to use git commit --amend. But this does not keep your micro history around. It just puts any recent changages into the last commit.

    # *hack*
    git commit -a -m"I am working on blah"
    # *hack*
    git commit --amend
    ...

    -Bart