Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to show a Git tree in terminal

Killswitchcollective.com's old article, 30 June 2009, has the following inputs and outputs

git co master git merge [your_branch] git push  upstream    A-B-C-D-E            A-B-C-D-E-F-G                  \        ---->               \ your branch       C-D-E                        G 

I am interested how you get the tree like-view of commits in your terminal without using Gitk or Gitx in OS/X.

How can you get the tree-like view of commits in terminal?

like image 783
Léo Léopold Hertz 준영 Avatar asked Jun 30 '09 15:06

Léo Léopold Hertz 준영


People also ask

How do you see the commit tree?

On GitHub, you can see the commit history of a repository by: Navigating directly to the commits page of a repository. Clicking on a file, then clicking History, to get to the commit history for a specific file.


1 Answers

How can you get the tree-like view of commits in terminal?

git log --graph --oneline --all 

is a good start.

You may get some strange letters. They are ASCII codes for colors and structure. To solve this problem add the following to your .bashrc:

export LESS="-R" 

such that you do not need use Tig's ASCII filter by

git log --graph --pretty=oneline --abbrev-commit | tig   // Masi needed this  

The article text-based graph from Git-ready contains other options:

git log --graph --pretty=oneline --abbrev-commit 

git log graph

Regarding the article you mention, I would go with Pod's answer: ad-hoc hand-made output.


Jakub Narębski mentions in the comments tig, a ncurses-based text-mode interface for git. See their releases.
It added a --graph option back in 2007.

like image 61
VonC Avatar answered Sep 29 '22 14:09

VonC