Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to retain commit gpg-signature after interactive rebase squashing?

When I want to squash some commits by interactive rebase:

git rebase -i HEAD~3 

And then:

pick cbd03e3 Final commit (signed) s f522f5d bla-bla-bla (signed) s 09a7b7c bla-bla (signed)  # Rebase c2e142e..09a7b7c onto c2e142e ... 

The final commit haven't gpg-signature despite that all of those commits have same signature. Is it possible to retain commit gpg-signature after interactive rebase squash?

like image 883
Alexander Yancharuk Avatar asked Sep 18 '13 14:09

Alexander Yancharuk


People also ask

How do I save changes in interactive rebase?

To save your changes and exit the document, type :wq! and press Enter key. It should appear at the end of the document like this. To exit the document without saving, type :q! and press Enter key.

How do you squash commits with interactive rebase?

Squash commits together. Two other commands rebase interactive offers us are: squash ( s for short), which melds the commit into the previous one (the one in the line before) fixup ( f for short), which acts like “squash”, but discards this commit's message.

How do I get out of interactive rebase?

you can abort the rebase by deleting the entire contents of the editor window and saving it, or causing the editor to close with an error code. In vim this can be accomplished with d SHIFT+g followed by :wq , or alternatively causing the editor to exit with an error as Mike H-R pointed out out using :cq .

What does dropping a commit in rebase do?

(drop) — If you remove a commit from the interactive rebase file, or if you comment it out, the commit will simply disappear as if it had never been checked in. Note that this can cause merge conflicts if any of the later commits in the branch depended on those changes.


1 Answers

Like Cupcake stated, you can't retain the old signature from the unsquashed commits, but you can sign the new squashed commit if you rebase like this:

git rebase --interactive [email protected] HEAD~4

Adding [email protected] as an argument will sign the final squashed commit.

like image 89
samurailink3 Avatar answered Sep 28 '22 12:09

samurailink3