-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
78 lines (75 loc) · 2.88 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
[user]
name = Anthony Clark
email = [email protected]
[init]
defaultBranch = main
[core]
excludesfile = ~/.dotfiles/.gitignore_global
pager = delta
[interactive]
diffFilter = delta --color-only
[delta]
navigate = true
[merge]
conflictstyle = diff3
[diff]
colorMoved = default
[delta]
light = true
syntax-theme = GitHub
line-numbers = true
[push]
default = current
autoSetupRemote = true
[fetch]
prune = true
[pull]
rebase = true
[alias]
# branch and checkout
take ="checkout -b"
# checkout
c = "checkout"
# short status
s = "status -s -b --renames"
# pull
p = "pull"
# reset head hard
rshh="reset head --hard"
# nah - https://laravel-news.com/the-ultimate-git-nah-alias
nah = "!f(){ git reset --hard; git clean -df; if [ -d ".git/rebase-apply" ] || [ -d ".git/rebase-merge" ]; then git rebase --abort; fi; }; f"
# nice log
l = "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --"
# Rebase against the $remote $branch
rb = "!f() { timestamp=$(date +%s); touch .gitstashflag 1>/dev/null && git add . 1>/dev/null && git stash push -m \"git-rbd-stash-${1}-${2}-${timestamp}\" 1>/dev/null && git pull --rebase $1 $2:-$(git rev-parse --abbrev-ref HEAD) && git stash pop 1>/dev/null && rm .gitstashflag 1>/dev/null && git rm .gitstashflag 1>/dev/null; }; f"
# wip it up
wipup = "!git add . && git commit -m wip && git push"
# https://laravel-news.com/five-ways-to-be-more-productive-with-git
forget="!git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D"
forgetlist="!git fetch -p && git branch -vv | awk '/: gone]/{print $1}'"
uncommit = reset --soft HEAD~1
# https://softwaredoug.com/blog/2022/11/09/idiot-proof-git-aliases.html
# Rebase workflow
mainbranch = "!git remote show origin | sed -n '/HEAD branch/s/.*: //p'"
synced = "!git pull origin $(git mainbranch) --rebase"
update = "!git pull origin $(git rev-parse --abbrev-ref HEAD) --rebase"
squash = "!git rebase -v -i $(git mainbranch)"
publish = push origin HEAD --force-with-lease
pub = publish
ammend = commit --amend
amend = commit --amend
# Github - From https://salferrarello.com/git-alias-open-pull-request-github/
pr = "!f() { \
open \"$(git ls-remote --get-url $(git config --get branch.$(git rev-parse --abbrev-ref HEAD).remote) \
| sed 's|[email protected]:\\(.*\\)$|https://github.com/\\1|' \
| sed 's|\\.git$||'; \
)/compare/$(\
git config --get branch.$(git rev-parse --abbrev-ref HEAD).merge | cut -d '/' -f 3- \
)?expand=1\"; \
}; f"
hub = "!f() { \
open \"$(git ls-remote --get-url \
| sed 's|[email protected]:\\(.*\\)$|https://github.com/\\1|' \
| sed 's|\\.git$||'; \
)\"; \
}; f"