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 enhance10privacy. The tool can be employed automatically for all Git repository11through global `githooks(5)` (see below).1213## Status1415I use this daily, works entirely fine for my purposes as is.1617## Installation1819This software only requires [libgit2][libgit2 website]. If libgit2 was20installed successfully, compile this software as follows:2122 make2324Afterwards, the software can be installed system-wide using:2526 make install2728## Usage2930This tool can be invoked manually from a Git repository. For example,31the following command would randomize timestamps of all unpushed32commits on the `master` branch (i.e. behaves like `git-rebase(1)`):3334 $ git shuffle origin/master3536However, it is likely desirable to automate this process through global37`githooks(5)`. For this purpose `core.hooksPath` will need to be set38using `git-config(1)`. Additionally, a `post-commit` hook must be39created which amends the previously created commit. For example using:4041 $ git config --global core.hooksPath ~/.config/git/hooks42 $ mkdir -p ~/.config/git/hooks43 $ printf "#!/bin/sh\ngit shuffle -a\n" > ~/.config/git/hooks/post-commit44 $ chmod +x ~/.config/git/hooks/post-commit4546Program usage is described further in the provided man page.4748## Portability4950This code requires `getentropy(3)` (which is available on Linux and51OpenBSD but not mandated by POSIX) and `timegm(3)` and `err.h` which are52also not mandated by POSIX but widely available on both Linux and BSD53systems.5455## Related Work5657The [git-privacy][git-privacy repo] utility shares the same goals but58has way more configuration options and is thus more complicated.59Furthermore, it doesn't utilize [libgit2][libgit2 website].6061## License6263This program is free software: you can redistribute it and/or modify it64under the terms of the GNU General Public License as published by the65Free Software Foundation, either version 3 of the License, or (at your66option) any later version.6768This program is distributed in the hope that it will be useful, but69WITHOUT ANY WARRANTY; without even the implied warranty of70MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General71Public License for more details.7273You should have received a copy of the GNU General Public License along74with this program. If not, see <http://www.gnu.org/licenses/>.7576[libgit2 website]: https://libgit2.org/77[git-privacy repo]: https://github.com/EMPRI-DEVOPS/git-privacy