Cheatsheet for viewing commits/branches in git

A couple notes on different log flags that I use for a couple applications

Only shows commits that are referred to by current state of branch
git log --graph --all --decorate --simplify-by-decoration

Shows all commits from all branches in a tree
git log --graph --all --decorate

A few notes on reading a branch.

If you are confronted with something like the following:


* commit 4589a323c3eddc4f488ea856c49db86d76bfe65f (Branch_5)
| Author: Neanderslob <neanderslob@neanderslob.com>
| Date: Tue Apr 14 01:52:17 2015 -0600
|
| Commit 5
|
| * commit d168ac4d7ab7e80c85d0630dc00a67319293f6a7 (Branch_4)
| | Author: Neanderslob <neanderslob@neanderslob.com>
| | Date: Tue Apr 28 15:01:00 2015 -0600
| |
| | Commit 4
| |
| * commit 06a6299ede5a1d6abf562b3a4999d6b6905dae80 (Branch_3/Branch_4)
|/ Author: Neanderslob <neanderslob@neanderslob.com>
| Date: Fri Apr 24 15:24:08 2015 -0600
|
| Commit 3
|
* commit 2118bcb9d2c5fae313841fa66a5af6294cf8ba31 (Branch_2)
| Author: Neanderslob <neanderslob@neanderslob.com>
| Date: Sat Apr 4 02:49:06 2015 -0600
|
| Commit 2
|
* commit 413697b0fbd36552613c51634080b419bf8ed6e9 (Branch_1)
| Author: Neanderslob <neanderslob@neanderslob.com>
| Date: Fri Mar 20 17:24:27 2015 -0600
|
| Commit 1

The way you read it is:

  • Branch_2 comes off of Branch_1.
  • Branch_3 and Branch_4 came off of branch 2 at the same point
    • Branch_4 is ahead of Branch_3
  • Branch_5 came off of Branch_2 as well but after 3&4 did
Advertisements
Cheatsheet for viewing commits/branches in git

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s