Skip to content

Commit 4261267

Browse files
improve wording
1 parent fd51e8f commit 4261267

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

scripts/git-append-commit-trailer

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,20 @@
11
#!/usr/bin/env bash
22
#
33
# Append a trailer with the commit hash to every commit message.
4-
# This can be useful if you rewrite the history later on and you want
5-
# to preserve the original commit hashes.
4+
#
5+
# # Why would you do this?
6+
#
7+
# Git commit hashes change when you rewrite history. If you release your
8+
# software with the exact build hash (you should, it eases debugging!),
9+
# then all released hashes won't be in your repository anymore. If you
10+
# add the original hashes to the commit messages, then you can find them
11+
# even after a history rewrite.
12+
#
13+
# Another use case for the original hashes is if you keep the original
14+
# repository as archive for reference (e.g. because your industry
15+
# requires you to keep *exactly* every state of the repositiry). The
16+
# hash in the commit message will help you to find the corresponding
17+
# commit in the original repository if necessary.
618
#
719
# Attention: Since the commit message is part of the commit hash
820
# calculation, this script changes the commit hashes too.
@@ -16,6 +28,16 @@
1628
# starting with refs/original/, unless forced.
1729
# See `man git-filter-branch`
1830
#
31+
# Example:
32+
# Purge the file `foo.dat` from the repository:
33+
#
34+
# Step 1: Run `git-append-commit-trailer`
35+
# Step 2: git-purge-files foo.dat
36+
#
37+
# Result: The file `foo.dat` was purged from the history and every
38+
# commit message has a link (original commit hash) to the
39+
# original version.
40+
#
1941
# Author: Lars Schneider, https://github.com/larsxschneider
2042
#
2143

0 commit comments

Comments
 (0)