Skip to content

Instantly share code, notes, and snippets.

@kwk
Created October 1, 2014 13:52
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save kwk/d70f20d17b18c4f3296d to your computer and use it in GitHub Desktop.
Save kwk/d70f20d17b18c4f3296d to your computer and use it in GitHub Desktop.
Forgot to sign-off commits?
@ghsatpute
Copy link

How to apply to specific commit
When I run
git filter-branch --msg-filter "cat - && echo && echo 'Signed-off-by: Ganesh Satpute <name@gmail.com>'" HEAD~2..HEAD~1
I get
Which ref do you want to rewrite?

@jan25
Copy link

jan25 commented Jun 16, 2019

For signing off a specific commit you could do git commit --amend -s -c <SHA>

@jan25
Copy link

jan25 commented Jun 16, 2019

@onajib
Copy link

onajib commented Jan 23, 2020

the command of jan25 works but with an uppercase S : git commit --amend -S -c <SHA>

@Florian-Schoenherr
Copy link

if you also want the commit with the SHA itself: git commit --amend -S -c <SHA>^

@hiteshagja
Copy link

hiteshagja commented Feb 15, 2022

git commit --amend --no-edit -S [SHA]
git push --force-with-lease [origin branch_name]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment