Skip to main content

Review commits in your feature branch

·161 words·1 min· ·
Git Github Hub
Ariejan de Vroom
Author
Ariejan de Vroom
Jack of all Trades, Professional Software Craftsman
Table of Contents

Github pull requests are awesome, but you can’t use them all the time, mostly when working on code not hosted at github.

The following snippet makes it easy to see the commits in your current (head) branch that are not yet in the base branch.

To see what commits are made in your current feature branch, but which have not been merged into develop yet:

$ gpr develop
* 5246248 <ariejan@ariejan.net> (HEAD, origin/feature-branch, feature-branch) Implements the awesome feature (50 minutes ago)
* 4f55b7c <ariejan@ariejan.net> Write specs for awesome feature (2 hours ago)

Snippets
#

To achieve this, add the following alias to ~/.gitconfig:

[alias]
    lg = log --graph --pretty=format:'%Cred%h%Creset %Cblue<%ae>%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative

And the following alias to your ~/.bashrc or ~/.zshrc:

alias gpr="git --no-pager lg HEAD --not $1"

Bonus tip
#

After reviewing the commits in your feature branch with gpr, use hub to attach your code to a github issue:

hub pull-request -i 42 -h ariejan:feature-branch -b you:develop

Related

Contributing to Open-Source with Github
·447 words·3 mins
Git Rebase Github Flow Fork Upstream
Codaset.com: Github, but better
·645 words·4 mins
Git Codaset Github
Binary debugging with git bisect
·960 words·5 mins
Git Bisect