17

Review commits in your feature branch

 3 years ago
source link: https://www.devroom.io/2013/03/08/review-commits-in-your-feature-branch/?utm_campaign=Feed%3A+ariejan+%28ariejan%7Cdevroom.io%29
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Review commits in your feature branch

Posted: 2013-03-08 - Last updated: 2019-06-05

Tagged git github hub

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 <[email protected]> (HEAD, origin/feature-branch, feature-branch) Implements the awesome feature (50 minutes ago)
* 4f55b7c <[email protected]> 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

My site is free of ads and trackers. I record privacy-respecting usage statistics with Fathom.

Was this post helpful to you? Why not ☕ Buy me a coffee

Copyright © 1999-2020 Ariejan de Vroom <[email protected]>

Live now; make now always the most precious time. Now will never come again.
    – Jean-Luc Picard


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK