-
Notifications
You must be signed in to change notification settings - Fork 2
/
.gitconfig
62 lines (62 loc) · 3.73 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
[user]
name = Parker Brown
email = 17183625+parkerbxyz@users.noreply.github.com
signingkey = ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILYVijVFVGBkUOHuqKGFE8OHJ5gXRguwMMX8KJ6SokR4
[gpg]
format = ssh
[gpg "ssh"]
program = /Applications/1Password.app/Contents/MacOS/op-ssh-sign
[commit]
gpgSign = true
[push]
default = simple
autoSetupRemote = true
[pull]
rebase = true
[fetch]
prune = true
[init]
defaultBranch = main
[protocol]
version = 2
[github]
user = parkerbxyz
[core]
autocrlf = input
editor = code --wait
[filter "lfs"]
clean = git-lfs clean -- %f
smudge = git-lfs smudge -- %f
process = git-lfs filter-process
required = true
[alias]
# Retrieve the default branch (helper alias)
default = "!f() { if ORIGIN_HEAD=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null); then echo $ORIGIN_HEAD | sed 's@^refs/remotes/origin/@@'; else git remote set-head origin --auto &>/dev/null && git default; fi; }; f"
# Prune remote-tracking branches that no longer exist on the remote and delete all branches without stashed changes that have been merged into the default branch
prune-branches = "!f() { git fetch --prune; (git branch-list-merged; git branch-list-no-stash) | sort | uniq -d | grep -v "$(git branch --show-current)" | xargs git branch -d; }; f"
# Sync your fork with the upstream repository
sync-fork = "!f() { DEFAULT=$(git default); git fetch upstream && git switch ${1-$DEFAULT} && git merge upstream/${1-$DEFAULT} && git push; }; f"
# Merge the latest changes from the default branch into the current branch
update-branch = "!f() { DEFAULT=$(git default); git switch $DEFAULT && git pull && git switch - && git merge $DEFAULT; }; f"
# Add a file/directory to .gitignore
ignore = "!f() { echo \"$1\" >> .gitignore; }; f"
# Display 10 most recently updated local branches (most recent first)
recent-branches = "!f() { git for-each-ref refs/heads --count=10 --sort=-committerdate --format='%(HEAD) %(if)%(HEAD)%(then)%(color:green)%(else)%(color:default)%(end)%(refname:short)%(color:reset)|%(objectname:short) %(upstream:track)|%(subject)|%(committerdate:relative)|%(authorname)' --color=always | column -ts'|'; }; f"
# Find commit that deleted a given file
find-deleted-file = log --full-history --no-merges -1 --
# List local branches without asterisk (great for use in scripts)
branch-list = "!f() { git branch $@ --format='%(refname:short)'; }; f"
# List local branches that have been merged with the default branch (excluding the default branch)
branch-list-merged = "!f() { DEFAULT=$(git default); git branch-list --merged $DEFAULT | grep -v "$DEFAULT"; }; f"
# List branches with stashed changes
stash-list-branches = "!f() { git stash list | awk -F 'WIP on |!!GitHub_Desktop<' '{print $2}' | awk -F ':|>' '{print $1}'; }; f"
# List local branches without stashed changes
branch-list-no-stash = "!f() { (git branch-list; git stash-list-branches) | sort | uniq -u; }; f"
# Check the status of all local branches
branch-list-status = "!f() { git for-each-ref refs/heads --sort=-committerdate --format='%(HEAD) %(refname:short)|%(objectname:short) %(upstream:track)|%(upstream:remotename)' | column -ts'|'; }; f"
# List local branches that have been deleted from the remote
branch-list-gone = "!f() { git branch-list-status | grep 'gone]' | grep -v '*' | awk '{print $1}'; }; f"
# List unmerged commits for a given branch (defaults to current branch if no branch is specified)
unmerged-commits = "!f() { DEFAULT=$(git default); CURRENT=$(git branch --show-current) git log --oneline --no-merges ${1-$CURRENT} ^$DEFAULT; }; f"
# Prune local branches that have been deleted from the remote (including branches with unmerged commits)
prune-gone-branches = "!f() { DEFAULT=$(git default); git branch-list-gone | grep -v "$DEFAULT" | xargs git branch -D; }; f"