Created
August 18, 2022 21:05
-
-
Save jenhagg/7aa1f48fc15b887f65384eff50b94ac1 to your computer and use it in GitHub Desktop.
config, for git.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is Git's per-user configuration file. | |
[user] | |
name = Jen Hagg | |
email = jen@breakthroughenergy.org | |
[pager] | |
branch = false | |
[credential] | |
helper = osxkeychain | |
[core] | |
editor = vim | |
[alias] | |
co = checkout | |
br = branch -vv | |
st = status | |
p = push origin HEAD | |
pf = push -f origin HEAD | |
prev = reset --soft HEAD^ | |
forget = reset --hard HEAD | |
nvm = reset --hard HEAD | |
ri = rebase -i | |
diffc = diff --cached | |
diffw = diff --word-diff | |
lsfiles = !"lsfiles() { git diff-tree --no-commit-id --name-only -r $1; }; lsfiles" | |
##### from https://github.com/jessfraz/dotfiles/blob/master/.gitconfig | |
# View abbreviated SHA, description, and history graph of the latest 20 commits | |
l = log --pretty=oneline -n 20 --graph --abbrev-commit | |
# View the current working tree status using the short format | |
s = status -s | |
# Commit all changes | |
ca = !git add -A && git commit -av | |
# Show the diff between the latest commit and the current state | |
d = !"git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat" | |
# Checkout a pull request from origin (of a github repository) | |
pr = !"pr() { git fetch origin pull/$1/head:pr-$1; git checkout pr-$1; }; pr" | |
# Switch to a branch, creating it if necessary | |
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f" | |
# Color graph log view | |
graph = log --graph --color --pretty=format:"%C(yellow)%H%C(green)%d%C(reset)%n%x20%cd%n%x20%cn%x20(%ce)%n%x20%s%n" | |
new = !"switch() { git branch -m old; git checkout -b $1 $2; git branch -D old; }; switch" | |
release = !"f() { git log --since \"$1\" --no-merges --format=\"%s (%aN)\" | sort; }; f" | |
default = !"git remote show origin | sed -n '/HEAD branch/s/.*: //p'" | |
# https://github.com/durdn/cfg/blob/master/.gitconfig | |
lasttag = describe --tags --abbrev=0 | |
lt = describe --tags --abbrev=0 | |
filelog = log -u | |
fl = log -u | |
ls = log --pretty=format:"%C(green)%h\\ %C(yellow)[%ad]%Cred%d\\ %Creset%s%Cblue\\ [%an]" --decorate --date=relative | |
ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cblue\\ [a:%an,c:%cn]" --decorate --numstat | |
########## | |
[fetch] | |
prune = true | |
[pull] | |
ff = only | |
[diff] | |
# Detect copies as well as renames | |
renames = copies | |
[rebase] | |
autosquash = true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment