Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding git-missing command #63

Merged
merged 2 commits into from
Jul 9, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Readme.md
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ $ brew install git-extras
- `git promote` - `git promote`
- `git local-commits` - `git local-commits`
- `git archive-file` - `git archive-file`
- `git missing`


## git-extras ## git-extras


Expand Down Expand Up @@ -529,3 +530,13 @@ List all commits on the local branch that have not yet been sent to origin. Any
## git-archive-file ## 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. 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
```
21 changes: 21 additions & 0 deletions bin/git-missing
Original file line number Original file line Diff line number Diff line change
@@ -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
70 changes: 70 additions & 0 deletions man/git-missing.1
Original file line number Original file line Diff line number Diff line change
@@ -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 [<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\.
.
.SH "OPTIONS"
[<first branch>]
.
.P
First branch to compare\. If not specified, defaults to currently checked out branch\.
.
.P
<second branch>
.
.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:
.
.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>
137 changes: 137 additions & 0 deletions man/git-missing.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 51 additions & 0 deletions man/git-missing.md
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,51 @@
git-missing(1) -- Show commits missing from another branch
=========================================================

## SYNOPSIS

`git-missing` [&lt;first branch&gt;] &lt;second branch&gt; [&lt;git log options&gt;]

## 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

[&lt;first branch&gt;]

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

&lt;second branch&gt;

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:

$ 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 &lt;<nate@endot.org>&gt;

## REPORTING BUGS

&lt;<http://github.com/visionmedia/git-extras/issues>&gt;

## SEE ALSO

&lt;<http://github.com/visionmedia/git-extras>&gt;