Repeatedly forgot to mention issue number of ticket in commit message

I repeatedly forgot to mention the ticket number of the corresponding gitlab issue in my commit messages. This is a Problem because it makes a tracing of the issues impossible.
2 answers

If you want to change commit message after commit, you can do this by:

git rebase --interactive '^'

With this rebase you want edit your commit comment, after that commit your changes:

git commit --all --amend --no-edit

At last go on with your rebase to finish it:

git rebase --continue
To get back to the HEAD.

SHA-1 of the commit changes, so be creaful by pushing your commits. Don't use git push --fore

To avoid such mistakes there exist so called git hooks.
You have to implement a git hook to check commit message before the commit.
Go to .git/hooks folder in repository.
There is a file called „commit.msg.sample“ .
Remove „sample“ in the file name.
place shell script in file „commit.msg“ which checks the commit message.

Comments

If you want to change commit message after commit, you can do this by:

git rebase --interactive '^'

With this rebase you want edit your commit comment, after that commit your changes:

git commit --all --amend --no-edit

At last go on with your rebase to finish it:

git rebase --continue
To get back to the HEAD.

SHA-1 of the commit changes, so be creaful by pushing your commits. Don't use git push --fore

Markus Hegedüs - Mon, 12/14/2020 - 17:16 :::