Skip to content

Instantly share code, notes, and snippets.

@JmPotato
Forked from disksing/sign.sh
Created August 17, 2020 09:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JmPotato/cafb091ddf2d8001b229e8d34cbb209d to your computer and use it in GitHub Desktop.
Save JmPotato/cafb091ddf2d8001b229e8d34cbb209d to your computer and use it in GitHub Desktop.
Sign off commit history
#!/bin/bash
# Add missing DCOs for current branch (starting from merge base to master)
# Following commit history as an example, this script will affect commits E,F,G.
#
# v master
# A - B - C - D - H - I
# \
# E - F - G
# ^ feature (HEAD)
#
# Please make sure the commits were submitted originated from you, or you have
# permission to submit the code.
git filter-branch -f --msg-filter \
'git interpret-trailers --if-missing add \
--trailer "Signed-off-by: $(git config user.name) <$(git config user.email)>"' \
master..HEAD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment