Skip to content

Instantly share code, notes, and snippets.

@mnojek
Created October 24, 2023 10:34
Show Gist options
  • Save mnojek/b24aa4277da0ddd859d3774f13a8da88 to your computer and use it in GitHub Desktop.
Save mnojek/b24aa4277da0ddd859d3774f13a8da88 to your computer and use it in GitHub Desktop.
Fill in the user details and rename to .gitconfig before use
[user]
name = <Your Name>
email = <your@email.com>
username = <your_username>
[core]
# enable parallel index preload to speed up operations like "git diff" or "git status"
preloadindex = true
# treats a carriage-return at the end of line as part of the line terminator
fscache = true
whitespace = cr-at-eol
# do not convert the file endings, set output to equal input
autocrlf = input
[gc]
# git automatically cleans the repo from loose objects when the amount exceeds 256
auto = 256
[rerere]
# enable "reuse recorded resolution" which remembers already resolved conflicts and reuses them in the future
enabled = 1
# automatically stage files that are solved
autoupdate = 1
[push]
# push the current branch to a remote branch with the same name
default = current
# automatically setup the remote branch without asking
autoSetupRemote = true
[color]
# make output colorful
ui = auto
[log]
# show shorter names of the commit objects in the log
abbrevCommit = true
[alias]
alias = ! git config --get-regexp ^alias\\. | sed -e s/^alias\\.// -e s/\\ /\\ =\\ /
# Pretty logs #
lg = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' --all
adog = log --all --decorate --oneline --graph
last = log --name-status HEAD^..HEAD
# Status #
st = status --short
stat = status
# File Handling #
aa = add --all
ap = add -p
uncommit = reset --soft HEAD~1
unstage = reset HEAD
discard = checkout --
rh = reset --hard
# Branch handling #
co = checkout
comr = checkout master
comn = checkout main
cod = checkout develop
cob = checkout -b
br = branch
brl = branch --list
brs = branch --sort=-committerdate
# Commit #
ci = commit
cim = commit -m
ciam = commit -a -m
ciaa = commit -a --amend
amend = commit -a --amend --no-edit
# Rebase #
rb = rebase
rbd = rebase develop
rbm = rebase master
rbc = rebase --continue
rbs = rebase --skip
rba = rebase --abort
rbi = rebase --interactive
# Stash #
sl = stash list
ss = stash save
sa = !sh -c \"git stash apply stash@{$1}\"
sd = !sh -c \"git stash drop stash@{$1}\"
# Remotes #
ups = remote add upstream
fu = fetch upstream
mu = merge upstream/master master
rbu = rebase upstream/master
rhu = reset --hard @{u}
# Pushing #
pu = push -u
puf = push -u -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment