__n5jw
Last Updated: February 25, 2016
·
2.829K
· jan0sch
2aaae7041aca85da930bcaf14d6768d2

A good .gitconfig starting point.

This is a .gitconfig I've been using for some years now and it has proven quite okay. It should be saved in your home directory e.g. /home/johndoe/.gitconfig. The push directive is set to current maybe simple is also a good option for you.

[user]
    name = John Doe
    email = john.doe@example.com
[color]
    branch = auto
    diff = auto
    interactive = auto
    pager = true
    status = auto
    ui = true
[color "status"]
    added = green
    changed = yellow
    untracked = red
[push]
    default = current
[core]
    autocrlf = input
    pager = less -FRSX
[alias]
    ci = commit
    co = checkout
    st = status -sb
    lg = log --graph --pretty=format:'%C(yellow)%h%C(auto)%d%Creset %s %C(white)- %an, %ar%Creset'

Here is a link to the github gist.

Say Thanks
Respond

8 Responses
Add your response

11938
7dedb03c52d9b14738f844c799b2dbc4

Here, another great example, https://github.com/gufranco/dotfiles/blob/master/.gitconfig.
With: --rebase options, alias, indentation and space corrections.
Comments are in portuguese.

over 1 year ago ·
11942
2aaae7041aca85da930bcaf14d6768d2

@fernandoperigolo Thanks for the link. There are some nice aliases there. :-)

over 1 year ago ·
12372
Jj1024x1024

For shortening your Git commands I would rather use shell aliases: https://coderwall.com/p/i3leza

over 1 year ago ·
12381
2aaae7041aca85da930bcaf14d6768d2

@jaccus With shell aliases you never know with which commands they may collide if you use (or are forced to use) a lot of different platforms and shells. Therefore I reduced my shell aliases to a bare minimum.

But if you're always on the same kind of plattform/environment I would also go for shell aliases because they're much shorter. :-)

over 1 year ago ·
12391
048230d83d50ff15f0b4fb4e0c033e5e

@jan0sch
I prefer %C(auto)%d%Creset because the different types of branches (HEAD, local, remote) are displayed in different colors (better readability!)

over 1 year ago ·
12408
2aaae7041aca85da930bcaf14d6768d2

@pmiossec Great hint! I've updated my gist accordingly. Really great if you happen to have a lot of branches.

over 1 year ago ·
12427
Df1412e1775840374894798d5ed9a7ea

I'll throw mine into the ring.

https://github.com/magnetikonline/dotfiles/blob/master/.gitconfig

I much prefer "git status -sb" for the "git st" alias. Smaller status output FTW! :)

over 1 year ago ·
12431
2aaae7041aca85da930bcaf14d6768d2

@magnetikonline There was a reason why I didn't use it as default. Although I can't remember it anymore. ;-) I believe it was due to a bug several git versions back.

over 1 year ago ·
Filed Under