Repository navigation
Expand file tree
/
Copy path.gitconfig
More file actions
91 lines (79 loc) · 2.84 KB
/
Copy path.gitconfig
File metadata and controls
91 lines (79 loc) · 2.84 KB
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
[user]
name = Gus Wynn
# Personal vs. work email
[includeIf "gitdir:repos/"]
path = .gitconfig-personal
[includeIf "gitdir:photography/"]
path = .gitconfig-personal
[includeIf "gitdir:work/"]
path = .gitconfig-work
[alias]
# status and viewing
st = status
br = branch -vv
d = diff
s = show
da = diff --cached
staged = diff --staged
# checkout
c = checkout
co = checkout
up = switch
# From Brandon, nice logging
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative -15 --branches=* --remotes=*
lglong = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative --branches=* --remotes=*
treeremote = lglong --simplify-by-decoration --decorate-refs-exclude='refs/pullreqs/*' --decorate-refs-exclude='refs/tags/*'
tree = lglong --simplify-by-decoration --decorate-refs-exclude='refs/pullreqs/*' --decorate-refs-exclude='refs/tags/*' --decorate-refs-exclude='refs/remotes/*/*'
# TODO branching
# up to date forks: https://stefanbauer.me/articles/how-to-keep-your-git-fork-up-to-date
# git fetch upstream
# git rebase upstream/<main branch>
# then push, might need force
#
# or try this
# git switch -C master upstream/master
# git pull upstream/master
#
# rename branch: https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx
# git branch -m master main
# git push -u origin main
# git push origin --delete <old branch>
#
# cleanup
# old branches:
# git branch --merged
# git branch -d <branch name>
#
# git remote prune origin (not sure on this one)
# git branch -r --merged
# git push origin --delete <branch name>
newup = remote add upstream
newor = remote add origin
# Some nice shorthands
quickamend = commit -a --amend --no-edit
pwf = push --force-with-lease
publish = "!git push -u origin $(git branch --show-current)"
refresh = "!git up main && git pull && git push origin main"
dmb = "!git-delete-merged-branches --effort 3"
branch-diff = "!git diff $(git merge-base --fork-point main)"
# Assisted-By Attribution
aa = "!f() { git commit --amend --no-edit --trailer=\"Assisted-By:\"$1\"\"; }; f"
# Worktrees
nw = "!f() { git worktree add ../\"$1\"-\"$2\" -b ann-\"$1\"/\"$2\"; }; f"
nwb = "!f() { git worktree add ../wt-\"$1\" -b \"$1\"; }; f"
wtenv = "!f() { mkdir .elasticbeanstalk; cp ../\"$1\"/.elasticbeanstalk/config.yml .elasticbeanstalk/config.yml; cp ../\"$1\"/.devel.env .devel.env; cp ../\"$1\"/.envrc .envrc; direnv allow; }; f"
[init]
defaultBranch = main
[diff]
noprefix = true
[core]
excludesFile = ~/repos/dotfiles/.gitignore
commentchar = ";"
[merge]
conflictstyle = diff3
[submodule]
recurse = true
[pull]
ff = only
[rerere]
enabled = true