allow options to be passed through to git log

This commit is contained in:
Nate Jones 2012-03-07 09:25:37 -08:00
parent 63d707c33c
commit e5c8d79e66
4 changed files with 31 additions and 9 deletions

View file

@ -1,7 +1,15 @@
#!/bin/sh
firstbranch=$1
secondbranch=$2
# grab first two non-option arguments
for arg in $*; do
if [[ $arg != -* ]]; then
test -z "$firstbranch" && firstbranch=$arg && continue
test -z "$secondbranch" && secondbranch=$arg && continue
else
# add anything else to a passthrough
passthrough="$passthrough $arg"
fi
done
test -z "$firstbranch" && echo "at least one branch required" && exit 1
@ -10,4 +18,4 @@ if test -z "$secondbranch"; then
firstbranch=
fi
git log $firstbranch...$secondbranch --format="%m %h %s" --left-right
git log $passthrough $firstbranch...$secondbranch --format="%m %h %s" --left-right

View file

@ -1,13 +1,13 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "GIT\-MISSING" "1" "December 2011" "" "Git Extras"
.TH "GIT\-MISSING" "1" "March 2012" "" "Git Extras"
.
.SH "NAME"
\fBgit\-missing\fR \- Show commits missing from another branch
.
.SH "SYNOPSIS"
\fBgit\-missing\fR [<first branch>] <second branch>
\fBgit\-missing\fR [<first branch>] <second branch> [<git log options>]
.
.SH "DESCRIPTION"
Shows commits that are in either of two branches but not both\. Useful for seeing what would come across in a merge or push\.
@ -24,6 +24,12 @@ First branch to compare\. If not specified, defaults to currently checked out br
.P
Second branch to compare\.
.
.P
[<git log options>]
.
.P
Any flags that should be passed to \'git log\', such as \-\-no\-merges\.
.
.SH "EXAMPLES"
Show commits on either my current branch or master but not both:
.

View file

@ -76,7 +76,7 @@
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p><code>git-missing</code> [&lt;first branch&gt;] &lt;second branch&gt;</p>
<p><code>git-missing</code> [&lt;first branch&gt;] &lt;second branch&gt; [&lt;git log options&gt;]</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
@ -93,6 +93,10 @@
<p> Second branch to compare.</p>
<p> [&lt;git log options&gt;]</p>
<p> Any flags that should be passed to 'git log', such as --no-merges.</p>
<h2 id="EXAMPLES">EXAMPLES</h2>
<p> Show commits on either my current branch or master but not both:</p>
@ -111,7 +115,7 @@
<h2 id="AUTHOR">AUTHOR</h2>
<p>Written by Nate Jones &lt;<a href="&#x6d;&#x61;&#x69;&#108;&#x74;&#111;&#58;&#x6e;&#97;&#x74;&#x65;&#x40;&#101;&#110;&#100;&#111;&#116;&#46;&#x6f;&#x72;&#103;" data-bare-link="true">&#x6e;&#97;&#116;&#101;&#x40;&#x65;&#110;&#100;&#x6f;&#116;&#x2e;&#111;&#x72;&#x67;</a>&gt;</p>
<p>Written by Nate Jones &lt;<a href="&#x6d;&#x61;&#x69;&#x6c;&#x74;&#111;&#x3a;&#110;&#97;&#x74;&#x65;&#x40;&#101;&#110;&#100;&#111;&#x74;&#46;&#x6f;&#114;&#x67;" data-bare-link="true">&#x6e;&#x61;&#116;&#101;&#x40;&#101;&#110;&#100;&#111;&#x74;&#x2e;&#x6f;&#114;&#103;</a>&gt;</p>
<h2 id="REPORTING-BUGS">REPORTING BUGS</h2>
@ -124,7 +128,7 @@
<ol class='man-decor man-foot man foot'>
<li class='tl'></li>
<li class='tc'>December 2011</li>
<li class='tc'>March 2012</li>
<li class='tr'>git-missing(1)</li>
</ol>

View file

@ -3,7 +3,7 @@ git-missing(1) -- Show commits missing from another branch
## SYNOPSIS
`git-missing` [&lt;first branch&gt;] &lt;second branch&gt;
`git-missing` [&lt;first branch&gt;] &lt;second branch&gt; [&lt;git log options&gt;]
## DESCRIPTION
@ -20,6 +20,10 @@ git-missing(1) -- Show commits missing from another branch
Second branch to compare.
[&lt;git log options&gt;]
Any flags that should be passed to 'git log', such as --no-merges.
## EXAMPLES
Show commits on either my current branch or master but not both: