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!