develwoutacause’s avatardevelwoutacause’s Twitter Archive—№ 1,665

  1. …in reply to @gkalpakas
    @gkalpakas I don't remember what problem I ran into at the time. Actually trying again now, I think this works as I was hoping. [alias] uncommit = "!MSG=$(git --no-pager log --format=%B -n 1 HEAD) && git reset HEAD~1 && git commit \ --allow-empty -m \"${MSG}\" > /dev/null"
    1. …in reply to @develwoutacause
      @gkalpakas I just realized I didn't format that command onto one line which introduced an unexpected backslash. Should be: uncommit = "!MSG=$(git --no-pager log --format=%B -n 1 HEAD) && git reset HEAD~1 && git commit --allow-empty -m \"${MSG}\" > /dev/null"
    2. …in reply to @develwoutacause
      @gkalpakas This keeps the empty commit around with the same message, so you can just do: $ git uncommit # Make changes. $ git commit --amend Works like hg uncommit --keep, which is what I was hoping for. I'll have to try this out a bit and see how it works out in practice.😁