Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+2 votes
3 views
in DevOps and Agile by (19.7k points)
edited by

See 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 in knowing 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 the terminal?

1 Answer

+1 vote
by (62.9k points)

You can try using:

git log --graph --oneline --all

is a good start.

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

export LESS="-R"

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

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

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

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

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...