Thread (2 messages) flat view 2 messages, 2 authors, 2016-06-15

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

From: Randal L. Schwartz <hidden>
Date: 2016-06-15 22:42:33

quoted
quoted
quoted
quoted
"Junio" == Junio C Hamano [off-list ref] writes:
quoted
## (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
[off-list ref] <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!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help