Skip to contentSkip to conversation

rebase: pass --signoff option to git am

PATCH In review Giuseppe Bilotta 5 participants 8 messages Jun 15, 2016 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 rebase: pass --signoff option to git am

This allows people (like me) that forget to sign off their commits to do a single rebase pass e.g. while preparing the patchset for submission.

---
 Documentation/git-rebase.txt |    6 ++++++
 git-rebase.sh                |    2 +-
 2 files changed, 7 insertions(+), 1 deletions(-)
Documentation/git-rebase.txt +6 -0
index 30e5c0e..d513e42 100644
@@ -320,6 +320,12 @@ link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for details).
 -p::
 --preserve-merges::
 	Instead of ignoring merges, try to recreate them.
+
+--signoff::
+	This flag is passed to 'git am' to sign off all the rebased
+	commits (see linkgit:git-am[1]).
+	Incompatible with the --interactive option.
+
 +
 This uses the `--interactive` machinery internally, but combining it
 with the `--interactive` option explicitly is generally not a good
git-rebase.sh +1 -1
index 0e9d52a..9de03ee 100755
@@ -354,7 +354,7 @@ do
 	--ignore-whitespace)
 		git_am_opt="$git_am_opt $1"
 		;;
-	--committer-date-is-author-date|--ignore-date)
+	--committer-date-is-author-date|--ignore-date|--signoff)
 		git_am_opt="$git_am_opt $1"
 		force_rebase=t
 		;;
Signature · 1 line
1.7.3.2.184.gecaee
#1 lore raw

Heya,

Quoted 8 lines · Giuseppe Bilotta

 -p::
 --preserve-merges::
       Instead of ignoring merges, try to recreate them. +
+--signoff::
+       This flag is passed to 'git am' to sign off all the rebased
+       commits (see linkgit:git-am[1]).
+       Incompatible with the --interactive option.

The one above that does have a shorthand (-p), why should we (not?) give --signoff it's customary -s shorthand here?

Signature · 3 lines
Cheers,

Sverre Rabbelier
#2 lore raw
Quoted 13 lines · Sverre Rabbelier

Heya,

Documentation/git-rebase.txt link:howto/revert-a-faulty-merge.txt[revert-a-faulty-merge How-To] for details). · line 327

Quoted 8 lines · Giuseppe Bilotta

-p::
--preserve-merges::
Instead of ignoring merges, try to recreate them.

Documentation/git-rebase.txt +5 -0
+
+--signoff::
+       This flag is passed to 'git am' to sign off all the rebased
+       commits (see linkgit:git-am[1]).
+       Incompatible with the --interactive option.
Quoted 2 lines

The one above that does have a shorthand (-p), why should we (not?) give --signoff it's customary -s shorthand here?

The '-s' flag is unfortunately already taken. It is used for specifying a merge strategy.

/Martin

#3 lore raw
Quoted 16 lines · Martin von Zweigbergk
Quoted 13 lines · Sverre Rabbelier

Heya,

Quoted 8 lines · Giuseppe Bilotta

 -p::
 --preserve-merges::
       Instead of ignoring merges, try to recreate them. +
+--signoff::
+       This flag is passed to 'git am' to sign off all the rebased
+       commits (see linkgit:git-am[1]).
+       Incompatible with the --interactive option.

Quoted 5 lines
Quoted 2 lines

The one above that does have a shorthand (-p), why should we (not?) give --signoff it's customary -s shorthand here?

The '-s' flag is unfortunately already taken. It is used for specifying a merge strategy.

In fact, this is why I was a little skeptical myself about submitting this patch. What if people start remembering that rebase supports --signoff and implicity assume that -s is also a valid shortcut? Funky errors. (I've been bittem myself by similar situations for whitespace support. Can I pass -b or not? Will it mean --ignore-whitespace?)

Signature · 1 line
Giuseppe "Oblomov" Bilotta
#4 lore raw
In reply to Giuseppe Bilotta
Quoted 2 lines · Giuseppe Bilotta

This allows people (like me) that forget to sign off their commits to do a single rebase pass e.g. while preparing the patchset for submission.

You're probably already aware, but git format-patch supports the -s/--signoff flags to sign off commits as they're prepared. There's even a config var you can set to make this the default (format.signoff = true).

-Kevin Ballard

#5 lore raw
Quoted 8 lines · Kevin Ballard
Quoted 2 lines · Giuseppe Bilotta

This allows people (like me) that forget to sign off their commits to do a single rebase pass e.g. while preparing the patchset for submission.

You're probably already aware, but git format-patch supports the -s/--signoff flags to sign off commits as they're prepared. There's even a config var you can set to make this the default (format.signoff = true).

That works if you're sharing your patches with format-patch, but not for example when asking for a pull. Maybe I should extend the commit message to include this case.

Signature · 1 line
Giuseppe "Oblomov" Bilotta
#6 lore raw
Quoted 6 lines · Giuseppe Bilotta
Quoted 5 lines · Kevin Ballard
Quoted 2 lines · Giuseppe Bilotta

This allows people (like me) that forget to sign off their commits to do a single rebase pass e.g. while preparing the patchset for submission.

Quoted 7 lines
Quoted 3 lines

You're probably already aware, but git format-patch supports the -s/--signoff flags to sign off commits as they're prepared. There's even a config var you can set to make this the default (format.signoff = true).

That works if you're sharing your patches with format-patch, but not for example when asking for a pull. Maybe I should extend the commit message to include this case.

For what it's worth, somebody on #git just asked how to signoff a bunch of patches. The answer was to rebase -i and sign off each one of them. This is exactly the kind of usage that my patch would simplify. Any chance of it getting merged?

Signature · 1 line
Giuseppe "Oblomov" Bilotta
#7 lore raw
Quoted 3 lines · Giuseppe Bilotta

For what it's worth, somebody on #git just asked how to signoff a bunch of patches. The answer was to rebase -i and sign off each one of them.

How I would do it in existing git:

git branch oldhead
git reset --keep base
git log --oneline --graph HEAD..oldhead; # the right patches?
git cherry-pick -s HEAD..oldhead
git diff oldhead

Or without multiple-cherry-pick, maybe:

git branch oldhead
git reset --keep base
git format-patch -k --stdout HEAD..oldhead >series
git am -s -3 -i series; # the right patches?
git diff oldhead

No opinion on the automatic-signoff-in-rebase here.