Mastering git, Part 1, setting up git environment, GUI, mergetool, difftool

Installing prerequisite

Configuring Git Environment

First config your environment and set a proper merge/ diff tool.  The settings in Linux are under/home/<username>/.gitconfig.    If you don’t know where this file is located in your OS You can easily edit this file by:

All Git setting can be set or viewed via terminal, i.e:

To view all settings

Current settings of mergetool:

Set the merge tool

All available options for setting a merge tools can be listed by:

here we config it for meld, kdiff3 and vim.


Add the following to your .gitconfig file

For Windows users:



For Windows users:



Username, Email and editor


Adding Alias


or add it via terminal:

SSH key

and upload your public key
into your GitHub account

Push into GitHub without a password using ssh-key

You have to change your remote type from http to git:

For example, if your repository is:

Then you have to run the following:

How to show the current branch in the Bash prompt

Edit ~/.bashrc and find the following lines and uncomment them

and replace them with

1, 2

Disabling Unix file permissions problem:
If you get the following message during a merge:

You have to disable the file mode. This usually happens when the repo is cloned between Windows and Linux/Unix machines.

Colors in Gitk

Yellow: Commit with the yellow circle is the HEAD. Gitk jumps to this commit once it got opened.
Red: Commit with a red circle is your uncommitted changes.
Blue: All other commits are shown in the blue circle.
Green: Local branches names are shown in green,
Orange, and green:  remote branch names are shown in a combination of orange and green, with the orange section being the remote name and the green section being the branch name.

0 0 votes
Article Rating
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x