-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgit-up
executable file
·36 lines (31 loc) · 909 Bytes
/
git-up
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/usr/bin/env sh
#
# Usage: git-up
#
# Like git-pull but show a short and sexy log of changes
# immediately after merging (git-up) or rebasing (git-reup).
#
# Inspired by Kyle Neath's `git up' alias:
# http://gist.github.com/249223
#
# Stolen from Ryan Tomayko
# http://github.com/rtomayko/dotfiles/blob/rtomayko/bin/git-up
#
set -e
current_branch=$(git rev-parse --abbrev-ref HEAD)
remote=${1:-origin}
branch=${2:-$current_branch}
[ $# -gt 2 ] && shift && shift && PULL_ARGS="$*"
command git pull --rebase "${remote}" "${branch}" ${PULL_ARGS[*]:-}
# show diffstat of all changes if we're pulling with --rebase.
echo
echo "Diff:"
echo "-----"
echo
command git --no-pager diff --color --stat "HEAD@{2}.." | sed 's/^/ /'
# show an abbreviated commit log of stuff that was just merged.
echo
echo "Log:"
echo "----"
echo
command git log --color --pretty=oneline --abbrev-commit "HEAD@{2}.." | sed 's/^/ /'