Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: d0ca3221ce
Fetching contributors…

Cannot retrieve contributors at this time

executable file 49 lines (37 sloc) 1.392 kb
#!/bin/bash
# vim :set ft=sh
# Show the changes on the remote that would be pulled in.
# The script fetches all the changes first.
#
# If this script is in your $PATH it can be called like this:
#
# git incoming
#
# The script requires git and ruby to be installed on your system.
#
# Copied from: https://raw.github.com/juretta/bin/master/git-incoming
# Return the name of the current branch
function current_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/';
}
CURRENT_BRANCH=`current_branch`
# What branch are we tracking?
TRACKING=$(git config branch.${CURRENT_BRANCH}.merge | ruby -ne 'print $_.gsub(/refs\/heads\//, "").strip')
# What's the name of the remote?
REMOTE=$(git config branch.${CURRENT_BRANCH}.remote)
# Log options
OPTS="--pretty=oneline --abbrev-commit --decorate"
# URL of the remote we are tracking
REMOTE_URL=$(git remote -v | ruby -e "puts STDIN.each_line.grep(/^${REMOTE}/).first.split[1]")
# Fetch the changes from the remote.
echo "Fetching changes from '"${REMOTE}"' (${REMOTE_URL})"
git fetch -q
# E.g. for 'master':
# git log master..origin/master
CHANGES=(env PAGER="" git log --color --exit-code $OPTS ${CURRENT_BRANCH}..${REMOTE}/${TRACKING})
if [ $? -eq 0 ]; then
echo "No changes on ${REMOTE} that are not already available on this branch."
else
echo "Changes on ${REMOTE}:"
echo $CHANGES
fi
Jump to Line
Something went wrong with that request. Please try again.