-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[git-same-sig-time] Unifies the GPG signature time with the commit's …
…time.
- Loading branch information
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
############################################################################# | ||
# git-same-sig-time: Unifies the GPG signature time with the commit's time. # | ||
# # | ||
# Part of HopeSeekr's BashScripts Collection # | ||
# https://github.com/hopeseekr/BashScripts/ # | ||
# # | ||
# Copyright © 2024 Theodore R. Smith <[email protected]> # | ||
# GPG Fingerprint: 4BF8 2613 1C34 87AC D28F 2AD8 EB24 A91D D612 5690 # | ||
# # | ||
# License: Creative Commons Attribution v4.0 International # | ||
# # | ||
############################################################################# | ||
|
||
git pretty -1 > /dev/null 2>&1 | ||
if [ "$?" -eq 1 ]; then | ||
echo "Error: You need \`git pretty\` installed. Add this to your ~/.gitconfig:" | ||
echo "" | ||
echo " [pretty]" | ||
echo " shortlog = format:%C(auto,yellow)%h%C(auto,magenta)% G? %Cred%ad %C(auto,green)%<(20,trunc)%aN%C(auto,reset)%s%C(auto,red)% gD% D" | ||
exit 1 | ||
fi | ||
|
||
# Get the count of git commits including and after the target commit. | ||
COMMIT_COUNT=$(git log --oneline "$1"^.. | wc -l) | ||
echo "Commit count: $COMMIT_COUNT" | ||
|
||
GIT_SEQUENCE_EDITOR="sed -i -re 's/^pick/edit/'" git rebase -i "$1"^ | ||
|
||
for a in $(eval echo {1.."$COMMIT_COUNT"}); do | ||
faketime "$(git pretty -1 | awk '{print $3" "$4}')" git commit --amend -S --no-edit | ||
git rebase --continue | ||
done |