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

Re: git-log to go forward instead of reverse?

From
Randal L. Schwartz <merlyn@stonehenge.com>
Date
Jul 10, 2006, 20:31 UTC
Message-ID
<861wstnqwd.fsf@blue.stonehenge.com>
In-Reply-To
<7vpsgdb40s.fsf@assigned-by-dhcp.cox.net>
>>>>> "Junio" == Junio C Hamano <junkio@cox.net> writes:
>> ## (code here to cd to the right dir omitted)
>> git-fetch
>> if git-status | grep -v 'nothing to commit'

Junio> git-status exits non-zero for "nothing to commit" case, so do Junio> not grep its output, but check the status of the command, to see Junio> if your tree is in a good shape to do a pull.

No, this is deliberate. I want to see nothing if we're up to date, but if not, I want to see *everything else* that git-status said. This nice "grep -v" does precisely the right thing.

Junio> Do we not leave ORIG_HEAD when we are already up-to-date? If so Junio> that would be confusing... No, we do leave ORIG_HEAD no matter Junio> what, so you do not have to have this inner if to grep Junio> up-to-date (on the other hand, you might want to do intelligent Junio> things when git-pull fails). So just drop the if and say Junio> something like:

Junio> else Junio> PAGER= ; export PAGER Junio> git pull . origin && Junio> git log --pretty ORIG_HEAD..HEAD | Junio> git shortlog Junio> fi

However, this is good to know.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
Previous: Junio C HamanoNext: Linus Torvalds
Message 10 of 11 in “git-log to go forward instead of reverse?”
  1. Randal L. SchwartzJul 10, 2006
  2. Linus TorvaldsJul 10, 2006
  3. Randal L. SchwartzJul 10, 2006
  4. Linus TorvaldsJul 10, 2006
  5. Randal L. SchwartzJul 10, 2006
  6. Linus TorvaldsJul 10, 2006
  7. Randal L. SchwartzJul 10, 2006
  8. Junio C HamanoJul 10, 2006
  9. Junio C HamanoJul 10, 2006
  10. Randal L. SchwartzJul 10, 2006
  11. Linus TorvaldsJul 10, 2006

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.