I should like to add my team name in the commit message automatically, that I have registered in the global config with the following command:
git config --global user.team "Seawolves"
There are many teams working in same project and we share a template file that is specified in gitconfig file.
[commit]
template = /mnt/share/gitmessage
Here is how part of my ~/.gitconfig look like:
cat ~/.gitconfig
[user]
name = Rajesh Khanna
email = rajesh.khanna@somthing.com
team = Seawolves
What is the best way to get the team name from ~/.gitconfig and git into the commit message? Should I use a prepare-commit-msg hook? Or is it an easier way to get the message in like its done automatically for email and name?
Or do I need to fetch it using the command: git config user.team
and just echo it into the message similar to what I found here: https://gist.github.com/bartoszmajsak/1396344/97081e76ab275f5fe526347908503febd1340495