a more helpful message on "git status" output
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). -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: a more helpful message on "git status" output
Julián Landerreche 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: a more helpful message on "git status" output
> 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: a more helpful message on "git status" output
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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: a more helpful message on "git status" output
Julián Landerreche 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. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: a more helpful message on "git status" output
Junio C Hamano writes: > Julián Landerreche 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/ -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html