# [PATCH] doc: format-patch: don't use origin as a branch name

4 messages from 2014-08-01 to 2014-08-01. Participants: Philip Oakley, Jonathan Nieder, Junio C Hamano.
Thread: https://gitlist.dev/t/37273

## Philip Oakley, 2014-08-01 19:20

Subject: [PATCH] doc: format-patch: don't use origin as a branch name
Message-ID: <1406920826-4680-1-git-send-email-philipoakley@iee.org>
URL: https://gitlist.dev/e/1406920826-4680-1-git-send-email-philipoakley%40iee.org

```
Historically (5 Nov 2005 v0.99.9-46-g28ffb89) the git-format-patch used
'origin' as the upstream branch name. This is now used to name the remote.
Use the more modern 'master' as the branch name.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
---

I noticed this while cross-checking details for updating the guide
Documentation/(git)everyday.txt
--
Philip

 Documentation/git-format-patch.txt | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/Documentation/git-format-patch.txt b/Documentation/git-format-patch.txt
index c0fd470..b0f041f 100644
--- a/Documentation/git-format-patch.txt
+++ b/Documentation/git-format-patch.txt
@@ -523,25 +523,25 @@ $ git format-patch -k --stdout R1..R2 | git am -3 -k
 ------------
 
 * Extract all commits which are in the current branch but not in the
-origin branch:
+master branch:
 +
 ------------
-$ git format-patch origin
+$ git format-patch master
 ------------
 +
 For each commit a separate file is created in the current directory.
 
-* Extract all commits that lead to 'origin' since the inception of the
+* Extract all commits that lead to 'master' since the inception of the
 project:
 +
 ------------
-$ git format-patch --root origin
+$ git format-patch --root master
 ------------
 
 * The same as the previous one:
 +
 ------------
-$ git format-patch -M -B origin
+$ git format-patch -M -B master
 ------------
 +
 Additionally, it detects and handles renames and complete rewrites
-- 
1.9.4.msysgit.0

```

## Jonathan Nieder, 2014-08-01 19:36

Subject: Re: [PATCH] doc: format-patch: don't use origin as a branch name
Message-ID: <20140801193614.GR12427@google.com>
URL: https://gitlist.dev/e/20140801193614.GR12427%40google.com
In-Reply-To: <1406920826-4680-1-git-send-email-philipoakley@iee.org>

```
Philip Oakley wrote:

> Historically (5 Nov 2005 v0.99.9-46-g28ffb89) the git-format-patch used
> 'origin' as the upstream branch name. This is now used to name the remote.
> Use the more modern 'master' as the branch name.

Would 'origin/master' make sense?

Thanks,
Jonathan

```

## Junio C Hamano, 2014-08-01 20:08

Subject: Re: [PATCH] doc: format-patch: don't use origin as a branch name
Message-ID: <xmqq8un8ug5d.fsf@gitster.dls.corp.google.com>
URL: https://gitlist.dev/e/xmqq8un8ug5d.fsf%40gitster.dls.corp.google.com
In-Reply-To: <20140801193614.GR12427@google.com>

```
Jonathan Nieder <jrnieder@gmail.com> writes:

> Philip Oakley wrote:
>
>> Historically (5 Nov 2005 v0.99.9-46-g28ffb89) the git-format-patch used
>> 'origin' as the upstream branch name. This is now used to name the remote.
>> Use the more modern 'master' as the branch name.
>
> Would 'origin/master' make sense?

It would make a lot more sense than 'master', I think.

The 'origin' will be DWIMmed to whatever the remote designated as
its primary branch, i.e. refs/remotes/origin/HEAD, and the
assumption the examples in question makes is that the user is
following along the simplest workflow to fork from it and upstream
her changes.  Between 'origin' and 'origin/master', there isn't much
difference because of it.  In the same spirit of following the
simplest workflow, that primary branch is likely to be their
'master', so 'origin/master' is OK but longer than 'origin' [*1*].

On the other hand, 'master' names the local 'master', which may be
very stale with respect to 'origin/master', or may have tons of
unrelated things that are not in origin/master, some of which may
have come from the branch the user is running format-patch to grab
patches to upstream.  For this reason, changing 'origin' to 'master'
is not an improvement at all, I would have to say.

We could further adjust the underlying assumption to more modern
"checkout -t -b" era, and use "format-patch @{u}", but I suspect
that the readers of these examples are not yet ready for magic
before the basics to spell out things more explicitly is covered.


[Footnote]

*1* Also using 'origin' will cover the case when the primary branch
at the remote were not named 'master', so in that sense it is
slightly better and more generally applicable.

```

## Philip Oakley, 2014-08-01 22:26

Subject: Re: [PATCH] doc: format-patch: don't use origin as a branch name
Message-ID: <F09DC14751724BEB809135DE720953E6@PhilipOakley>
URL: https://gitlist.dev/e/F09DC14751724BEB809135DE720953E6%40PhilipOakley
In-Reply-To: <xmqq8un8ug5d.fsf@gitster.dls.corp.google.com>

```
From: "Junio C Hamano" <gitster@pobox.com>
> Jonathan Nieder <jrnieder@gmail.com> writes:
>
>> Philip Oakley wrote:
>>
>>> Historically (5 Nov 2005 v0.99.9-46-g28ffb89) the git-format-patch 
>>> used
>>> 'origin' as the upstream branch name. This is now used to name the 
>>> remote.
>>> Use the more modern 'master' as the branch name.
>>
>> Would 'origin/master' make sense?
>
> It would make a lot more sense than 'master', I think.
>
> The 'origin' will be DWIMmed to whatever the remote designated as

I'd rather not provide an example that requires extra understanding on 
behalf of the reader on the DWIMing, especially as the example doesn't 
actually match the guidance in gitrevisions(7) [2].

The synopsis says it should either be a single commit <since>, or a 
<revision range>, the latter specified via gitrevisions(7), so theirs 
already an opportunity for confusion, but I take your point.

> its primary branch, i.e. refs/remotes/origin/HEAD, and the
> assumption the examples in question makes is that the user is
> following along the simplest workflow to fork from it and upstream
> her changes.  Between 'origin' and 'origin/master', there isn't much
> difference because of it.  In the same spirit of following the
> simplest workflow, that primary branch is likely to be their
> 'master', so 'origin/master' is OK but longer than 'origin' [*1*].

which suggests that maybe the example text should clarify any assumprion 
like that..
>
> On the other hand, 'master' names the local 'master', which may be
> very stale with respect to 'origin/master', or may have tons of
> unrelated things that are not in origin/master, some of which may
> have come from the branch the user is running format-patch to grab
> patches to upstream.  For this reason, changing 'origin' to 'master'
> is not an improvement at all, I would have to say.

I didn't see it that way, my view (presumption?) of the workflow was 
that the user had a branch 'current' which they had branched from their 
'master', thus the updated command felt natural.
>
> We could further adjust the underlying assumption to more modern
> "checkout -t -b" era, and use "format-patch @{u}", but I suspect
> that the readers of these examples are not yet ready for magic
> before the basics to spell out things more explicitly is covered.

agreed

>
>
> [Footnote]
>
> *1* Also using 'origin' will cover the case when the primary branch
> at the remote were not named 'master', so in that sense it is
> slightly better and more generally applicable.
>
--
Philip
[2] the DWIMs listed in the <refname> example of gitrevisions(7), to the 
niave reader, needs to be ref/ prefixed, which isn't what we'd hope 
(assuming they ever read it ;-). 

```
