File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Create your commit message template file
2+ 1 . For example, create a file at ~ /.gitmessage.txt:
3+ ```
4+ vi ~/.gitmessage.txt
5+ ```
6+ Add your desired template, e.g.:
7+ ```
8+ # Title: Short summary (50 chars max)
9+
10+ # Description: Detailed explanation (wrap at 72 chars)
11+
12+ # Issue: Link or ID
13+ ```
14+ Save and exit
15+
16+ 2 . Set it as your global Git commit message template:
17+ ```
18+ git config --global commit.template ~/.gitmessage.txt
19+ ```
20+ 3 . Confirm it's set correctly:
21+ ```
22+ git config --global --get commit.template
23+ ```
24+ It should return:
25+ ```
26+ /home/yourusername/.gitmessage.txt
27+ ```
28+ Result:
29+ Now every time you run git commit (without -m), your editor will open with this template pre-filled.
30+
31+ Let me know if you want an example tailored to a specific use case (like bug tracking, feature development, etc).
You can’t perform that action at this time.
0 commit comments