Git default configuration (Linux)

To define a default configuration file for git it’s usually a good idea. This way we can easily set our personal details, alias, colors… and make a backup of it. Of course it can be done using commands but it’s better to don’t waste time with trivial things.

Create the .gitconfig file (If it doesn’t exist) in the home directory:

vim ~/.gitconfig

Insert the default configuration:

[color]
        ui = true
[user]
        name = Ander Ustarroz
        email = [email protected]
[alias]
        co = checkout
        ci = commit
        st = status
        br = branch
        hist = log --pretty=format:\"%h %ad | %s%d [%an]\" --graph --date=short
        ticketlog = log --oneline --name-status -1
        type = cat-file -t
        dump = cat-file -p
        d = difftool

This is just an example, feel free to edit the config file as you wish.
For more information about .gitconfig visit the git documentation page.

Leave a Reply

Your email address will not be published. Required fields are marked *