Skip to content

Commit

Permalink
very uncertain about this, but here goes!
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewfallshaw committed Jun 22, 2019
1 parent 220d831 commit b740ded
Showing 1 changed file with 100 additions and 17 deletions.
117 changes: 100 additions & 17 deletions gitconfig
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
[user]
name = user-name
email = user-email
[core]
excludesfile = userdirectory/.gitignore
editor = vim -c 'set ft=diff'
whitespace = fix
[apply]
whitespace = nowarn
[alias]
ch = checkout
chb = checkout -b
co = commit
st = status
coa = commit -a
d = diff
pl = pull
pu = push
[color]
branch = auto
diff = auto
interactive = auto
status = auto
ui = auto
[core]
excludesfile = userdirectory/.gitignore
editor = vim -c 'set ft=diff'
whitespace = fix
[mirror]
summary = true
[merge]
summary = true
tool = opendiff
[color "diff"]
new = yellow
[status]
Expand All @@ -35,7 +23,26 @@
user = github-user
token = github-token
[push]
default = tracking
# simple = like upstream with an added safety to refuse to push if the
# upstream branch’s name is different from the local one
# upstream = push the current branch back to the branch whose changes are
# usually integrated into the current branch (which is called
# `@{upstream}`)
default = simple
[pull]
rebase = true
[merge]
summary = true
tool = smerge
[diff]
tool = smerge
[mergetool "smerge"]
cmd = smerge mergetool "$BASE" "$LOCAL" "$REMOTE" "$MERGED" -o "$MERGED"
trustExitCode = true
[difftool "smerge"]
cmd = smerge mergetool "$BASE" "$LOCAL" "$REMOTE"
[mergetool]
keepBackup = false
[credential]
helper = osxkeychain
[filter "ascr"]
Expand All @@ -48,5 +55,81 @@
required = true
[hub]
protocol = ssh
[alias]
t = status
a = add -p # Adds changes chunk-by-chunk. Very handy.
aa = add -A # Adds all changes.
co = checkout
cob = checkout -b # Creates a new branch at the current location (e.g. `git cob new-branch`).
cop = checkout -p # Resets changes chunk-by-chunk. Also very handy. (To instead reset file changes,
# you can use `git co -- file1 folder2`, or `git co -- .` to reset them all.)
cm = commit -m # Commit with message, e.g. `git cm "Whitespace fixes"`
ca = commit --amend # Instead of making a new commit, updates the last commit.
cma = commit --all -m
rh = reset HEAD # Resets changes you've staged with `git add`.
# (This won't touch the files, and is very safe.)
p = push
l = pull
d = diff
f = fetch --prune # Fetches remote branches, and removes deleted remote branches.

# Display with `git lg`, a prettier version of `git log` that shows branches.
# Highly recommended for knowing what's going on with the history.
lg = log --graph --all --pretty=format':%C(yellow)%h%Cred%d%Creset %s %C(white) %an, %ar%Creset'

# Branch management
pu = ! git push --set-upstream origin $(git rev-parse --abbrev-ref HEAD)
# Pushes (and sets upstream) to a branch with the same name. Very handy for new branches.
db = branch -d # Deletes a local branch. This will not let you delete a branch that isn't merged -
# in that case you'll need `fdb` defined below.

# Scary branch management
fp = push --force # 'Force push' overrides the remote branch. Take care with this one! Useful after rebasing.
fdb = branch -D # Forcibly deletes a branch (e.g. `git fdb old-branch`). You can usually find it again
# with `git reflog` if you notice quickly you made a mistake.
dbf = branch -D
mb = branch -f # Forcibly moves a branch to the current location. Useful if you e.g. have origin/master
# checked out, and want to move a branch there. Will lose the old branch!

# Merge things
mt = mergetool
dt = difftool
m = merge --no-ff # Merges in another branch. Always creates a merge commit.
ff = merge --ff-only # Fast-forwards to another branch. Will not merge or rebase.
# (e.g. `git ff origin/master` will move your branch forward to match origin/master.)
ffm = merge --ff-only origin/master # Specialized to origin/master.

# Rebase things
rb = rebase --preserve-merges # The default way to move your commits on top of another branch.
rbm = rebase --preserve-merges origin/master # Specialized to moving your changes on top of origin/master.
rbi = rebase -i # An interactive rebase which lets you choose which commits to apply, and in which order. Very powerful.
rbmi = rebase -i origin/master # Specialized to moving on top of origin/master.
rbim = rebase -i origin/master
cont = rebase --continue
abort = rebase --abort

# Working tree management
pop = stash pop

# Pretty unsafe
rhard = reset HEAD --hard # Nukes all changes and resets everything to the current commit.
rhard1 = reset HEAD~1 --hard # Nukes everything and moves to the previous commit.
rhard2 = reset HEAD~2 --hard # Nukes everything and moves to the previous previous commit.
fcl = clean --force # Deletes all untracked files (that aren't gitignored). Useful when you have junk lying around.
fcld = clean --force -d # Deletes all untracked files and directories (that aren't gitignored). Irrecoverably.
ignore-unsafe = update-index --assume-unchanged # Stops tracking changes to a file. Use with care.

# Submodules
su = submodule update --init --recursive # Updates submodules, should you forced into that little corner of hell.
ll = ! git pull && git submodule update --recursive # Pulls and updates submodules. (Does not initiliaze new ones.)

# Misc things
po = push origin # To delete a branch, `git push origin :branch`, i.e. `git po :branch`.
com = checkout master
coom = checkout origin/master
cg = config --global # Easily access global git configuration =)
cge = config --global --edit
mom = ! git checkout origin/master && git branch -f master && git checkout master
# "Move to origin/master" - moves the master branch there and checks it out.

# vi:filetype=conf

0 comments on commit b740ded

Please sign in to comment.