RSSAmplifier

Max Böck | Notes · May 15, 2019

15 May 2019

0
Sign in to vote or save

This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.

We use gitlab issues at work, which supports tagging commit messages with an issue number, to make that commit appear in the issue thread. I often forget to tag my messages though, and then remember a second after committing. So I wrote a little helper function as a custom git command: #!/bin/sh OLD_MSG = $( git log --format = %B -n1 ) git commit --amend -m " $OLD_MSG , # $1 " It’s just a simple…

We use gitlab issues at work, which supports tagging commit messages with an issue number, to make that commit appear in the issue thread. I often forget to tag my messages though, and then remember a second after committing.

So I wrote a little helper function as a custom git command:

#!/bin/sh
OLD_MSG=$(git log --format=%B -n1)
git commit --amend -m "$OLD_MSG, #$1"

It’s just a simple shell script that fetches the last commit message and appends the issue number. So I can do this:

$ git commit -m "add css grid support"
# ah fuck, forgot that this is related to an issue!
$ git append-issue 27
# commit msg is now: "add css grid support, #27"

To make it work:

  • Name the shell script git-append-issue (no extension)
  • save it in a folder in your home directory, i.e. ~/git-commands
  • make it executable with chmod 555
  • add that folder to your $PATH
  • git now recognizes your custom command!

Read on mxb.dev

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.