From 545df09676dbaa67f9810b6fa2a94005f0a529f8 Mon Sep 17 00:00:00 2001 From: Arctic Ice Studio Date: Thu, 7 Mar 2019 09:48:44 +0100 Subject: [PATCH] Implement Git alias to list commits ahead/behind tracking branch 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 --- snowblocks/git/gitconfig | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/snowblocks/git/gitconfig b/snowblocks/git/gitconfig index aa09e0f..43b36a1 100755 --- a/snowblocks/git/gitconfig +++ b/snowblocks/git/gitconfig @@ -408,6 +408,22 @@ # 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: @@ -443,14 +459,6 @@ # git lch | 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 + # +----------------------+