git/list[1] front-page[2] threads[3] people[4] search[5] about
 

a more helpful message on "git status" output

From
JLJulián Landerreche <maniqui@gmail.com>
Date
Jul 18, 2014, 19:03 UTC
Message-ID
<CAKQhN+rK0ftwC5hX4hDhXZbcEGAfCCBXRaQXYnMFLmR=n21OLA@mail.gmail.com>

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).

Next: Junio C Hamano
Message 1 of 6 in “a more helpful message on "git status" output”
  1. Julián LanderrecheJul 18, 2014
  2. Junio C HamanoJul 18, 2014
  3. Julián LanderrecheJul 18, 2014
  4. Jonathan NiederJul 18, 2014
  5. Junio C HamanoJul 18, 2014
  6. Matthieu MoyJul 21, 2014

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.