Git settings » History » Version 1
Alexander Watzinger, 2020-04-11 12:13
1 | 1 | Alexander Watzinger | h2. Useful git configuration settings |
---|---|---|---|
2 | |||
3 | These options can be configured in your global git config file e.g. ~/.gitconfig on Linux: |
||
4 | <pre> |
||
5 | [user] |
||
6 | name = Your Name |
||
7 | email = your@email.net |
||
8 | [color] |
||
9 | ui = true |
||
10 | [core] |
||
11 | editor = vim |
||
12 | [fetch] |
||
13 | prune = true |
||
14 | [merge] |
||
15 | tool = meld |
||
16 | [mergetool] |
||
17 | keepBackup = false |
||
18 | [status] |
||
19 | showUntrackedFiles = all |
||
20 | </pre> |
||
21 | Or using shell commands e.g. |
||
22 | |||
23 | <pre> |
||
24 | git config --global fetch.prune true |
||
25 | </pre> |
||
26 | |||
27 | h2. Prompt with branch and dirty indicator |
||
28 | |||
29 | <pre> |
||
30 | vim ~/.bashrc |
||
31 | </pre> |
||
32 | <pre> |
||
33 | function parse_git_dirty { |
||
34 | [[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" |
||
35 | } |
||
36 | function parse_git_branch { |
||
37 | git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/" |
||
38 | } |
||
39 | PS1='\[\e[1;34m\]\u@\h:\w\[\e[0;32m\]$(parse_git_branch)\[\e[1;34m\]\$ \[\e[m\]' |
||
40 | </pre> |