-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitconfig
95 lines (84 loc) · 3.66 KB
/
.gitconfig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# Local/private config goes in the include
[include]
path = ~/.gitconfig.local
#[hub]
# protocol = https
[color]
diff = auto
status = auto
branch = auto
ui = true
[help]
autocorrect = 1
[push]
# See `git help config` (search for push.default)
# for more information on different options of the below setting.
#
# Setting to git 2.0 default to suppress warning message
default = simple
[core]
excludesfile = ~/.gitignore_global
attributesfile = ~/.gitattributes_global
[filter "clean_ipynb"]
clean = "jq --indent 1 \
'(.cells[] | select(has(\"outputs\")) | .outputs) = [] \
| (.cells[] | select(has(\"execution_count\")) | .execution_count) = null \
| .metadata = {\"language_info\": {\"name\": \"python\", \"pygments_lexer\": \"ipython3\"}} \
| .cells[].metadata = {} \
'"
smudge = cat
required = true
[alias]
## From coderwall : https://coderwall.com/p/euwpig/a-better-git-log
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative
###########################################
# The essentials
###########################################
# -sb for a less verbose status
st = status -sb
# Easy commits fixup. To use with git rebase -i --autosquash
# fixup = commit --fixup
# If you use Hub by Github
# ci = ci-status
###########################################
# The command line sugar
###########################################
wip = !git add -u && git commit -m "WIP"
# Pop your last commit out of the history! No change lost, just unindexed
pop = reset HEAD^
# Fix your last commit without prompting an editor
oops = commit --amend --no-edit
# Add a file/directory to your .gitignore
ignore = "!f() { echo \"$1\" >> .gitignore; }; f"
# A more concise and readable git log
ls = log --pretty=format:"%C(yellow)%h\\ %Creset%s%Cblue\\ [%cn]\\%Cred%d" --decorate
# Same as above, with files changed in each commit
ll = ls --numstat
# Print the last commit title & hash
last = --no-pager log -1 --oneline --color
###########################################
# This much sugar may kill you
###########################################
# Show which commits are safe to amend/rebase
# unpushed = log @{u}..
# Show what you've done since yesterday to prepare your standup
standup = log --since yesterday --author $(git config user.email) --pretty=short
# Show the history difference between a local branche and its remote
divergence = log --left-right --graph --cherry-pick --oneline $1...origin/$1
# Quickly solve conflicts using an editor and then add the conflicted files
edit-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; vim `f`"
add-unmerged = "!f() { git diff --name-status --diff-filter=U | cut -f2 ; }; git add `f`"
# From comments
amen = !git commit --amend --no-edit && git push --force-with-lease origin HEAD
# List all branches and sort them by commit date
br = branch --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]' --sort=-committerdate
# https://stackoverflow.com/a/57601163/7657658
stashgrep = "!f() { for i in `git stash list --format=\"%gd\"` ; \
do git stash show -p $i | grep -H --label=\"$i\" \"$@\" ; done ; }; f"
[filter "jupyter_clear_output"]
clean = "jupyter nbconvert --stdin --stdout --log-level=ERROR \
--to notebook --ClearOutputPreprocessor.enabled=True"
smudge = cat
required = true
[init]
defaultBranch = main