git-shuffle

Randomize Git commit timestamps to enhance privacy

git clone https://git.8pit.net/git-shuffle.git

 1# git-shuffle
 2
 3Randomize timestamps associated with Git commits to enhance privacy.
 4
 5## Motivation
 6
 7Git associates timestamps with commits. These timestamps expose coding
 8hours and thereby potentially violate ones privacy. This tool randomizes
 9the hour of the day, as contained in these timestamps, to enhance
10privacy. The tool can be employed automatically for all Git repository
11through global `githooks(5)` (see below).
12
13## Status
14
15I use this daily, works entirely fine for my purposes as is.
16
17## Installation
18
19This software only requires [libgit2][libgit2 website]. If libgit2 was
20installed successfully, compile this software as follows:
21
22	make
23
24Afterwards, the software can be installed system-wide using:
25
26	make install
27
28## Usage
29
30This tool can be invoked manually from a Git repository. For example,
31the following command would randomize timestamps of all unpushed
32commits on the `master` branch (i.e. behaves like `git-rebase(1)`):
33
34	$ git shuffle origin/master
35
36However, it is likely desirable to automate this process through global
37`githooks(5)`. For this purpose `core.hooksPath` will need to be set
38using `git-config(1)`. Additionally, a `post-commit` hook must be
39created which amends the previously created commit. For example using:
40
41	$ git config --global core.hooksPath ~/.config/git/hooks
42	$ mkdir -p ~/.config/git/hooks
43	$ printf "#!/bin/sh\ngit shuffle -a\n" > ~/.config/git/hooks/post-commit
44	$ chmod +x ~/.config/git/hooks/post-commit
45
46Program usage is described further in the provided man page.
47
48## Portability
49
50This code requires `getentropy(3)` (which is available on Linux and
51OpenBSD but not mandated by POSIX) and `timegm(3)` and `err.h` which are
52also not mandated by POSIX but widely available on both Linux and BSD
53systems.
54
55## Related Work
56
57The [git-privacy][git-privacy repo] utility shares the same goals but
58has way more configuration options and is thus more complicated.
59Furthermore, it doesn't utilize [libgit2][libgit2 website]. There is
60also [git-backdate][git-backdate repo].
61
62## License
63
64This program is free software: you can redistribute it and/or modify it
65under the terms of the GNU General Public License as published by the
66Free Software Foundation, either version 3 of the License, or (at your
67option) any later version.
68
69This program is distributed in the hope that it will be useful, but
70WITHOUT ANY WARRANTY; without even the implied warranty of
71MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
72Public License for more details.
73
74You should have received a copy of the GNU General Public License along
75with this program. If not, see <http://www.gnu.org/licenses/>.
76
77[libgit2 website]: https://libgit2.org/
78[git-privacy repo]: https://github.com/EMPRI-DEVOPS/git-privacy
79[git-backdate repo]: https://github.com/rixx/git-backdate