Showing posts with label git. Show all posts
Showing posts with label git. Show all posts

Thursday, October 18, 2012

Useful Git branch graphs

There's always the easy way of doing Git branch graphs in terminal by entering:
$ git log --graph --oneline --all

It's pretty useful, however here are a couple of excellent commands I came across on SO (thanks to user: Slipp Douglas ) which I use all the time and I thought I'd share them here..

log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative




log --graph --all --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(bold white)— %an%C(reset)' --abbrev-commit



The first one is what I use very often since it shows the author and more importantly how long ago a commit was made. So I can very quickly just scan the "how long ago" section to identify any recently made changes without having to read dates and make sense of them

However, in some cases when you do need the dates, the second command specifies the entire date and time too but it spans on 2 lines instead of just 1. Very useful nevertheless.

Ref: http://stackoverflow.com/a/9074343/1415352

Wednesday, October 10, 2012

Display active git branch in bash prompt

For linux..

$ sudo nano ~/.bashrc

Add the following line to the bottom..

PS1="\u@\h:\w\$(git branch 2>/dev/null | grep -e '\* ' | sed 's/^..\(.*\)/{\1}/') \$ "

Save and quit. Restart terminal. cd into your git repo and you should see you're current branch.

Ref: http://gregk.me/2011/display-active-git-branch-in-bash-prompt/

Monday, October 1, 2012

git: 'svn' is not a command - Fix!

If while attempting to do a 'git svn clone...' you get the error
git: 'svn' clone is not a command

.. you simply need to install the git-svn package:
sudo apt-get install git-svn

Friday, September 28, 2012

Popular Posts