diff --git a/Readme.md b/Readme.md index efc60ed..b3c70bf 100644 --- a/Readme.md +++ b/Readme.md @@ -66,6 +66,7 @@ $ brew install git-extras - `git promote` - `git local-commits` - `git archive-file` + - `git missing` ## git-extras @@ -523,3 +524,13 @@ List all commits on the local branch that have not yet been sent to origin. Any ## git-archive-file Creates an zip archive of the current git repository. The name of the archive will depend on the current HEAD of your git respository. + +## git-missing [branch1] branch2 + +Print out which commits are on one branch or the other but not both. + +```bash +$ git missing master +< d14b8f0 only on current checked out branch +> 97ef387 only on master +``` diff --git a/bin/git-missing b/bin/git-missing new file mode 100755 index 0000000..7a7c8b5 --- /dev/null +++ b/bin/git-missing @@ -0,0 +1,21 @@ +#!/bin/sh + +# 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 + +if test -z "$secondbranch"; then + secondbranch=$firstbranch + firstbranch= +fi + +git log $passthrough $firstbranch...$secondbranch --format="%m %h %s" --left-right diff --git a/man/git-missing.1 b/man/git-missing.1 new file mode 100644 index 0000000..0deada4 --- /dev/null +++ b/man/git-missing.1 @@ -0,0 +1,70 @@ +.\" generated with Ronn/v0.7.3 +.\" http://github.com/rtomayko/ronn/tree/0.7.3 +. +.TH "GIT\-MISSING" "1" "March 2012" "" "Git Extras" +. +.SH "NAME" +\fBgit\-missing\fR \- Show commits missing from another branch +. +.SH "SYNOPSIS" +\fBgit\-missing\fR [] [] +. +.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\. +. +.SH "OPTIONS" +[] +. +.P +First branch to compare\. If not specified, defaults to currently checked out branch\. +. +.P + +. +.P +Second branch to compare\. +. +.P +[] +. +.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: +. +.IP "" 4 +. +.nf + +$ git missing master +< d14b8f0 only on current checked out branch +> 97ef387 only on master +. +.fi +. +.IP "" 0 +. +.P +Show commits on either branch foo or branch bar but not both: +. +.IP "" 4 +. +.nf + +$ git missing foo bar +< b8f0d14 only on foo +> f38797e only on bar +. +.fi +. +.IP "" 0 +. +.SH "AUTHOR" +Written by Nate Jones <\fInate@endot\.org\fR> +. +.SH "REPORTING BUGS" +<\fIhttp://github\.com/visionmedia/git\-extras/issues\fR> +. +.SH "SEE ALSO" +<\fIhttp://github\.com/visionmedia/git\-extras\fR> diff --git a/man/git-missing.html b/man/git-missing.html new file mode 100644 index 0000000..bc0d2c5 --- /dev/null +++ b/man/git-missing.html @@ -0,0 +1,137 @@ + + + + + + git-missing(1) - Show commits missing from another branch + + + + +
+ + + +
    +
  1. git-missing(1)
  2. +
  3. Git Extras
  4. +
  5. git-missing(1)
  6. +
+ +

NAME

+

+ git-missing - Show commits missing from another branch +

+ +

SYNOPSIS

+ +

git-missing [<first branch>] <second branch> [<git log options>]

+ +

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.

+ +

OPTIONS

+ +

[<first branch>]

+ +

First branch to compare. If not specified, defaults to currently checked out branch.

+ +

<second branch>

+ +

Second branch to compare.

+ +

[<git log options>]

+ +

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:

+ +
$ git missing master
+< d14b8f0 only on current checked out branch
+> 97ef387 only on master
+
+ +

Show commits on either branch foo or branch bar but not both:

+ +
$ git missing foo bar
+< b8f0d14 only on foo
+> f38797e only on bar
+
+ +

AUTHOR

+ +

Written by Nate Jones <nate@endot.org>

+ +

REPORTING BUGS

+ +

<http://github.com/visionmedia/git-extras/issues>

+ +

SEE ALSO

+ +

<http://github.com/visionmedia/git-extras>

+ + +
    +
  1. +
  2. March 2012
  3. +
  4. git-missing(1)
  5. +
+ +
+ + diff --git a/man/git-missing.md b/man/git-missing.md new file mode 100644 index 0000000..befa030 --- /dev/null +++ b/man/git-missing.md @@ -0,0 +1,51 @@ +git-missing(1) -- Show commits missing from another branch +========================================================= + +## SYNOPSIS + +`git-missing` [<first branch>] <second branch> [<git log options>] + +## 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. + +## OPTIONS + + [<first branch>] + + First branch to compare. If not specified, defaults to currently checked out branch. + + <second branch> + + Second branch to compare. + + [<git log options>] + + 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: + + $ git missing master + < d14b8f0 only on current checked out branch + > 97ef387 only on master + + Show commits on either branch foo or branch bar but not both: + + $ git missing foo bar + < b8f0d14 only on foo + > f38797e only on bar + +## AUTHOR + +Written by Nate Jones <> + +## REPORTING BUGS + +<> + +## SEE ALSO + +<>