Skip to content

Commit

Permalink
Implement Git alias to list commits ahead/behind tracking branch
Browse files Browse the repository at this point in the history
There was only the `lnew` alias that lists commit behind `ORIG_HEAD` (1)
which only works after a solved merge conflict.
This is not very useful and has been replaced by two new aliases:

- `lahead` - Lists all commits the current branch is ahead of the
  tracked origin branch that have not been pushed yet.
- `lbehind` - Lists all ahead commits of the tracked origin branch that
  are not merged into the current branch yet.

References:
  (1) https://git-scm.com/docs/gitrevisions#gitrevisions

Resolves GH-180
  • Loading branch information
arcticicestudio committed Mar 7, 2019
1 parent 118e658 commit 545df09
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions snowblocks/git/gitconfig
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,22 @@
# <ABBREVIATED_SHA1> <COMMIT_MESSAGE> <REFS>
l = log --graph --pretty=format:'%C(cyan)%h %C(white)%s %C(cyan bold)%d'

# Lists all commits the current branch is ahead of the tracked origin branch that have not been pushed yet.
#
# Depends on:
# alias.l
# Usage:
# git lahead
lahead = ! git l @{u}..HEAD

# Lists all ahead commits of the tracked origin branch that are not merged into the current branch yet.
#
# Depends on:
# alias.l
# Usage:
# git lbehind
lbehind = ! git l HEAD..@{u}

# Prints a prettified flat commit log without topic commits from merges.
#
# Depends on:
Expand Down Expand Up @@ -443,14 +459,6 @@
# git lch <TAG>|<SHA1>
lch = ! git l $1..HEAD

# Lists all new commits after the fetch including stats.
#
# Depends on:
# alias.l
# Usage:
# git lnew
lnew = ! git l ORIG_HEAD.. --stat

# +----------------------+
# + Information - Status +
# +----------------------+
Expand Down

0 comments on commit 545df09

Please sign in to comment.