Create Change Id in git commit message for Gerrit review automatically - lifuzu/cafe GitHub Wiki

  1. Create a folder, e.g. ~/.git/templates/hooks;
mkdir -p ~/.git/templates/hooks
  1. Download git hooks here: https://gist.github.com/lifuzu/5985927 and put them into ~/.git/templates/hooks;
  2. Add the following BOLD section in ~/.gitconfig:

[color]
        ui = auto
[user]
        name = USERNAME
        email = EMAIL
**[init]**
        **templatedir = ~/.git/templates**
  1. Try to have a new git clone, check the folder .git/hooks under the local repo folder, it should be like this:

ls -ls .git/hooks/
total 12
8 -rwxrwxr-x 1 user user 4252 Jun 17 16:13 commit-msg
4 -rwxrwxr-x 1 user user 1646 Jun 17 16:13 pre-auto-gc
⚠️ **GitHub.com Fallback** ⚠️