Monday, February 2, 2015

A quick Git tutorial part 4

Git notes
Normally, when you commit something, you add a short description to tell what's the commit about.
Such description should be short, with just one line.
But sometimes you'd like to give more information about the commit, something like a note.
Well, Git has a solution for that too. We can add a note like this:
$git notes add HEAD
This will bring you to a default editor to write your note.

Another easier approach is:
$git notes add HEAD -m "This is my note"
This way you can add a note right away.
The above way is comparable with a description for a commit "git commit -m 'this is my comment'".

This feature is added since version 1.6.6!
The note is not added in Sha calculation, so you don't need to amend a commit.


git show-branch
This one is very handy, if you want to compare commit revisions between two branches. Say you were working on a branch and you don't remember whether a feature has already included in the master branch. You can off course switch to the master branch and do a log, but that's not necessary now :) Just do the following in your working branch:
git show-branch master workingbranch
And you get a nice output about the difference between two branches.
Cool right?


For more information, read this link: http://git-scm.com/blog/2010/08/25/notes.html

No comments:

Post a Comment

NSNotification example