* a more helpful message on "git status" output
@ 2014-07-18 19:03 Julián Landerreche
2014-07-18 19:29 ` Junio C Hamano
0 siblings, 1 reply; 6+ messages in thread
From: Julián Landerreche @ 2014-07-18 19:03 UTC (permalink / raw)
To: git
Hi,
when running "git status", if the current branch can be
fast-forwarded, the user get this message:
On branch master
Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
The suggestion of using "git pull" for updating the local branch,
although it will work, might not be a proper choice or advice in terms
of what is really needed to just update the local branch.
As the user already has the newer commits locally (ie. the commits
have been already "git fetch"ed), he just needs to merge them. Running
"git pull" will unnecessarily try to fetch commits from upstream
again.
So...
Proposal: suggesting the user to run "git merge" or "git merge
origin/master" seems a more helpful suggestion, imo. Also, for
beginners, it helps for better understanding on what's going on, and
goes in hand with the usual advice of using "git fetch" + "git merge"
(instead of "git pull") to grasp better some Git concepts and how Git
works.
So, the output of git status would read like this:
On branch master
Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
(use "git merge origin/master" to update your local branch)
(it could read "git merge" too, if it defaults to merging upstream,
tracked branch).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a more helpful message on "git status" output
2014-07-18 19:03 a more helpful message on "git status" output Julián Landerreche
@ 2014-07-18 19:29 ` Junio C Hamano
2014-07-18 19:47 ` Julián Landerreche
0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2014-07-18 19:29 UTC (permalink / raw)
To: Julián Landerreche; +Cc: git
Julián Landerreche <maniqui@gmail•com> writes:
> when running "git status", if the current branch can be
> fast-forwarded, the user get this message:
>
> On branch master
> Your branch is behind 'origin/master' by 6 commits, and can be fast-forwarded.
> (use "git pull" to update your local branch)
>
> The suggestion of using "git pull" for updating the local branch,
> although it will work, might not be a proper choice or advice in terms
> of what is really needed to just update the local branch.
>
> As the user already has the newer commits locally (ie. the commits
> have been already "git fetch"ed), he just needs to merge them. Running
> "git pull" will unnecessarily try to fetch commits from upstream
> again.
By running "git pull", the user may obtain yet newer commits from
the upstream, which very likely will happen in an active project, or
"git fetch" launched by "git pull" will return without doing
anything after noticing there is nothing new.
As long as the updates to the upstream is also a fast-forward, it
will still fast-forward you, but to an even newer state of the
upstream.
There is no harm done[*1*] by suggesting "git pull" over "git
merge", no?
[Footnote]
*1* There is a bigger problem with this message, especially when the
user sees it on 'master', but your message is about the case where
you are strictly behind and that bigger problem will not be an
issue, so I won't discuss it further.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a more helpful message on "git status" output
2014-07-18 19:29 ` Junio C Hamano
@ 2014-07-18 19:47 ` Julián Landerreche
2014-07-18 21:05 ` Jonathan Nieder
2014-07-18 21:12 ` Junio C Hamano
0 siblings, 2 replies; 6+ messages in thread
From: Julián Landerreche @ 2014-07-18 19:47 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
> By running "git pull", the user may obtain yet newer commits from
> the upstream, which very likely will happen in an active project, or
> "git fetch" launched by "git pull" will return without doing
> anything after noticing there is nothing new.
>
> As long as the updates to the upstream is also a fast-forward, it
> will still fast-forward you, but to an even newer state of the
> upstream.
>
> There is no harm done[*1*] by suggesting "git pull" over "git
> merge", no?
OK, I'm mostly convinced.
A more verbose, educational output could read:
(use "git pull" to fetch newer commits from upstream and update your
local branch)
(use "git merge" to update your local branch)
> [Footnote]
>
> *1* There is a bigger problem with this message, especially when the
> user sees it on 'master', but your message is about the case where
> you are strictly behind and that bigger problem will not be an
> issue, so I won't discuss it further.
No idea what's this "bigger problem with this message". Care to expand?
Thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a more helpful message on "git status" output
2014-07-18 19:47 ` Julián Landerreche
@ 2014-07-18 21:05 ` Jonathan Nieder
2014-07-18 21:12 ` Junio C Hamano
1 sibling, 0 replies; 6+ messages in thread
From: Jonathan Nieder @ 2014-07-18 21:05 UTC (permalink / raw)
To: Julián Landerreche; +Cc: Junio C Hamano, git
Julián Landerreche wrote:
> A more verbose, educational output could read:
>
> (use "git pull" to fetch newer commits from upstream and update your local branch)
> (use "git merge" to update your local branch)
Yes, I like this idea, with a few qualifications:
1. The first line is long. Is there a shorter way to say the same
thing? Maybe
(use "git pull" to fetch newer commits and update your local branch)
2. s/from upstream/from $remote/ (e.g., "from origin") in the first
line? Though that would make problem (1) worse.
3. Is there some way to make it more obvious these two hints are
independent suggestions and that the user doesn't need to do both?
Maybe something as simple as
(or use "git merge" to update your local branch)
4. Should the advice differ based on whether the current branch is set
up for merging or rebasing?
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a more helpful message on "git status" output
2014-07-18 19:47 ` Julián Landerreche
2014-07-18 21:05 ` Jonathan Nieder
@ 2014-07-18 21:12 ` Junio C Hamano
2014-07-21 10:20 ` Matthieu Moy
1 sibling, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2014-07-18 21:12 UTC (permalink / raw)
To: Julián Landerreche; +Cc: git
Julián Landerreche <maniqui@gmail•com> writes:
>> By running "git pull", the user may obtain yet newer commits from
>> the upstream, which very likely will happen in an active project, or
>> "git fetch" launched by "git pull" will return without doing
>> anything after noticing there is nothing new.
>>
>> As long as the updates to the upstream is also a fast-forward, it
>> will still fast-forward you, but to an even newer state of the
>> upstream.
>>
>> There is no harm done[*1*] by suggesting "git pull" over "git
>> merge", no?
>
> OK, I'm mostly convinced.
> A more verbose, educational output could read:
>
> (use "git pull" to fetch newer commits from upstream and update your
> local branch)
> (use "git merge" to update your local branch)
I actually do not like that, to be honest.
These brief reminders should be just that, and if anything, we
should aim to make them shorter and more concise, not longer and
more verbose. They will never be sufficient to replace "education"
(otherwise why would we even have complete manual?)---they should
just point the users clearly in the right direction.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: a more helpful message on "git status" output
2014-07-18 21:12 ` Junio C Hamano
@ 2014-07-21 10:20 ` Matthieu Moy
0 siblings, 0 replies; 6+ messages in thread
From: Matthieu Moy @ 2014-07-21 10:20 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Julián Landerreche, git
Junio C Hamano <gitster@pobox•com> writes:
> Julián Landerreche <maniqui@gmail•com> writes:
>
>> OK, I'm mostly convinced.
>> A more verbose, educational output could read:
>>
>> (use "git pull" to fetch newer commits from upstream and update your
>> local branch)
>> (use "git merge" to update your local branch)
>
> I actually do not like that, to be honest.
>
> These brief reminders should be just that, and if anything, we
> should aim to make them shorter and more concise, not longer and
> more verbose.
I think so too. For someone not willing to read the doc, the current
message is sufficient, and for someone willing to read it, the output of
"git status" is IHMO not a good place to teach the difference between
merge and pull.
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-07-21 10:20 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-18 19:03 a more helpful message on "git status" output Julián Landerreche
2014-07-18 19:29 ` Junio C Hamano
2014-07-18 19:47 ` Julián Landerreche
2014-07-18 21:05 ` Jonathan Nieder
2014-07-18 21:12 ` Junio C Hamano
2014-07-21 10:20 ` Matthieu Moy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox