Skip to content

Instantly share code, notes, and snippets.

@syogaraj
Created April 5, 2023 02:54
Show Gist options
  • Select an option

  • Save syogaraj/1a7148cb9f818968bf3db756154c3c22 to your computer and use it in GitHub Desktop.

Select an option

Save syogaraj/1a7148cb9f818968bf3db756154c3c22 to your computer and use it in GitHub Desktop.
How to signoff a pushed commit
  1. Run git log to find the commit hash of the commit you want to sign off.

  2. Use the git rebase -i command to interactively rebase the commit. Replace COMMIT_HASH with the commit hash you identified:

    git rebase -i COMMIT_HASH^

    This will open an editor with a list of commits, starting from the one you specified.

  3. In the editor, change the keyword pick to edit for the commit you want to sign off, save the changes, and close the editor.

  4. Amend the commit to include the "Signed-off-by" line. You can use the --signoff or -s flag with the git commit command:

    git commit --amend --signoff

    This will open an editor with the commit message. Make sure the "Signed-off-by" line is added at the end of the message, save the changes, and close the editor.

  5. Complete the rebase process by running: git rebase --continue

  6. If you've made these changes on a local branch that has already been pushed to a remote repository, you'll need to force push the changes: git push --force-with-lease origin YOUR_BRANCH_NAME

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