How to sign-off an older commit

Hey everyone, I am working on this PR and mistakenly I’d not signed off my first five commits and during course of review as I was suggested to do some chages and still I’m being suggested to do so, I’ve made another signed off commits and I’ve also merged other’s commits in order to keep my local repository synced with upsteam. so the problem is that my first five unsigned off commits are far away such that I can’t get their number in commit history if I were to able to do this I would have signed off them using git rebase HEAD~N --signoff but I’m unable to do so. if anyone knows its solution please answere.

This might help you

@Savio.Dias this solution is for in-hand code changes that has not been committed yet, my problem is that I have a long history of commit and I am unable to figure out the number of commit to which I want to sign off.

I feel you can try with interactive rebase.
If I find an exact solution I’ll let you know.
I’m tagging people who might have an answer
// @Abhi @Chadha93 @vishalvivekm

1 Like

I do have a solution for this

  1. git rebase --interactive < commit-number >^

    If 6b05a31 is your commit number , git rebase --interactive 6b05a31^

  2. A terminal will open

Change from pick to edit for the commits which you wish to sign-off

  1. git commit --amend --no-edit --signoff
    git rebase --continue

  2. git push --force origin < branch-name >

2 Likes