Skip to content

Instantly share code, notes, and snippets.

@disksing
Last active September 2, 2020 03:19
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save disksing/4122718e910e33138032a72a45688480 to your computer and use it in GitHub Desktop.
Save disksing/4122718e910e33138032a72a45688480 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