Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think you might be aware given the specific words you use but for the benefit of others:

Git commit --fixup lets you attach new commits to previous hashes you specify and then can automatically (or semi-manually depending on settings) squash them in rebases.



You can combine this with the `:/<text>` syntax [0] for matching the most recent commit with a given text in the commit message, e.g.

    $ commit frobinator/ -m "refactor the frobnicator"

    [ more work ]

    $ commit echaton/ -m "immanentize the eschaton"

    [ oops, missed a typo ]

    $ commit frobinator/ --fixup :/frobic
0: https://stackoverflow.com/a/52039150


Thanks, I am —- but I always found it easier to just give the new commit a name I know how to squash rather than type in a SHA.

The other post about being able to do it on a substring match sounds way more ergonomic though, I’ll have to try that!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: