-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitconfig
45 lines (37 loc) · 1.71 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
[core]
filemode = false
autocrlf = input
editor = vim
[color]
ui = true
[user]
name = Greg Folker
email = gregfolker.dev@gmail.com
[url "ssh://git@github.com/"]
insteadOf = https://github.com/
[push]
default = simple
[alias]
st = status
ft = fetch --all
psh = push origin HEAD --force-with-lease
pll = pull --rebase --ff
ls = log --oneline
lsbr = branch -vv
# `git c <file1>...<fileN>` adds the file to the staging area and creates a new commit
# @note - `git c .` does this for all changes in the current working directory
c = "!f() { git add $@ && git commit; }; f"
# `git ca` takes all changes in the current working directory, adds them to the previous commit, and amends it
ca = commit --amend -C HEAD
# `git cam` is identical to `git ca` but allows the user to edit the commit message
cam = commit --amend -c HEAD
# `git br <new-branch>` creates a new local branch that tracks `origin/main`
br = "!f() { git checkout -b $1 --track origin/main; }; f"
# `git co <branch>` switches to an existing local branch
co = "!f() { git checkout -B $1; }; f"
# `git corb <remote-branch>` checkouts a new local branch, pulls a remote branch into it, and sets the upstream tracking branch to `origin/main`
corb = "!f() { git checkout -b $1 && git pull origin $1 --rebase --ff --no-commit && git branch --set-upstream-to=origin/main; }; f"
# `git rmbr <branch1>...<branchN>` force deletes all of the specified local branches
rmbr = "!f() { git branch -D $@; }; f"
# `git rma` removes all local branches that have already been merged into `main`
rma = "!f() { git branch --merged ${1-main} | grep -v ' ${1-main}$' | xargs -r git branch -d 2> /dev/null; }; f"