Skip to content

Instantly share code, notes, and snippets.

@arlimus
Last active May 17, 2021 18:36
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arlimus/5883472 to your computer and use it in GitHub Desktop.
Save arlimus/5883472 to your computer and use it in GitHub Desktop.
my gitconfig configuration
# git config; arlimus, public domain
## Make your adjustments
########################
[user]
name = Your Name
email = your.name@email.com
[core]
# excludesfile = /home/xxx/.gitignore-global
pager = less -FRX
editor = vim
# # in case your firewall is blocking git://, use https:// instead
# [url "https://"]
# insteadOf = git://
#
# Example:
[url "git@github.com:"]
insteadOf = https://github.com/
## in case you push to unverifyable https, disable verification
# [http]
# sslVerify=false
## Global configuration
#######################
[alias]
a = add --all
ap = add -p
au = add --update
b = branch
ba = branch -a
bi = bisect
cl = clone
co = checkout
com = !git checkout "$(git rev-list HEAD --max-count 1)" && git branch -d master && git checkout master
corm = !git checkout $1 && git rebase origin/master
cofm = !git fetch --all --prune && git checkout $1 && git rebase origin/master
codm = !NAME=$(git rev-parse --abbrev-ref HEAD) && test -n "$NAME" && git fetch --all --prune && git checkout master && git pull && git branch -d "$NAME"
ccc = "!WORD=$(echo $1) && BRANCH=$(git rev-parse --abbrev-ref HEAD) && git commit -m\"$BRANCH: $WORD\" #"
d = diff --color
dc = diff --color --cached
dd = difftool --dir-diff
f = fetch
fa = fetch --all --prune
# fetch a github branch; usage: git feb https://github.com/user/proj/pull/1234
feb = !REFI="$(echo $1)" && PULL_ID="$(echo $REFI | sed 's_.*/__' | tr -d '[[:space:]]')" && BRANCH="pr/$PULL_ID" && git fetch origin pull/$PULL_ID/head:$BRANCH && sleep 1 && git checkout $BRANCH && echo "You are on $BRANCH from "
# Not working, todo: ghco = "!f(){ URL=\"$1\"; NAME=\"$2\"; B=\"$(echo $URL | grep --color=never -o 'pull/[^/]*')/head:$NAME\"; git fetch origin $B; git checkout $NAME}; f"
c = commit -s
cc = commit --amend
cm = commit -m
ca = commit -a -s
cam = commit -a -s -m
cp = commit -s -p
cs = commit -s -m
# show commit graph
l = log --color --oneline --graph --decorate=short --all --simplify-by-decoration
ll = log --color --oneline --graph --decorate=short --all
# show merged commit graph
lm = log --color --format="%C(green)%s%C(yellow)%d%Creset%n%b" --graph --decorate=short --merges
lam = log --color --format="%C(green)%s%C(yellow)%d%Creset%n%b" --graph --decorate=short --merges --all
# show diffs and commit names
ld = log --color --decorate=short -p
lad = log --color --decorate=short -p --all
# show just the diffs for commits
lp = log --color --oneline --decorate=short -p
lap = log --color --oneline --decorate=short -p --all
# show commit graph with commit names and logs
lt = log --color --graph --decorate=short --all --simplify-by-decoration
llt = log --color --graph --decorate=short --all
lls = log --color --graph --decorate=short --all --stat
# show commit graph with files that were changed
lf = log --color --oneline --graph --decorate=short --name-only
laf = log --color --oneline --graph --decorate=short --name-only --all
m = merge --no-ff
mf = merge --ff-only
p = push
pa = push --all
pt = push --tags
po = push -u origin
pu = push -u origin --force-with-lease
pl = pull
pla= pull --all
rpa = remote prune --dry-run
rp = remote prune
r = reset
ri = rebase -i
rim= rebase -i master
rio= rebase -i origin/master
rsh= reset --soft HEAD
rhh= reset --hard HEAD
s = status --short
ss = status
t = tag
[apply]
whitespace = fix
[pager]
status = true
[pull]
ff = only
[push]
default = matching
[color]
ui = auto
# For Linux:
[giggle]
main-window-maximized = true
main-window-geometry = 0x0+0+0
history-view-vpane-position = 293
main-window-view = HistoryView
file-view-vpane-position = 530
[merge]
tool = meld
[mergetool "meld"]
trustExitCode = true
# Helpful to remember:
# * create a patch
# git format-patch origin/master..HEAD --stdout > update.patch
# * apply a patch
# git am --signoff < update.patch
@arlimus
Copy link
Author

arlimus commented Apr 17, 2016

feb [github-pr-url]

Checkout someone's pull-request (e.g. on github). This will create a branch and switch to it:

> git feb https://github.com/chef/inspec/pull/488
From github.com:chef/inspec
 * [new ref]         refs/pull/488/head -> pr/488
Switched to branch 'pr/488'
You are on pr/488 from https://github.com/chef/inspec/pull/488

@arlimus
Copy link
Author

arlimus commented May 17, 2021

updated to current version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment