Skip to content

Instantly share code, notes, and snippets.

@sidneyspe
Last active July 21, 2023 05:00
Show Gist options
  • Save sidneyspe/707d3c16a855b53eed25383f7897cc58 to your computer and use it in GitHub Desktop.
Save sidneyspe/707d3c16a855b53eed25383f7897cc58 to your computer and use it in GitHub Desktop.
alias for git
[user]
email = [email protected]
name = Your Name
[credential]
helper = store
[color]
branch = auto
diff = auto
status = auto
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
sync = !git tag -l | xargs git tag -d && git fetch -t
st = status -sb
sf = show --name-only
re = rebase -i HEAD~
caa = commit -a --amend -C HEAD
co = checkout
cc = checkout -b
ci = commit -am
ac = !git add -A && git commit -am
lg = log --pretty=format:'%Cred%h%Creset %C(bold)%cr%Creset %Cgreen<%an>%Creset %s' --max-count=30
lt = describe --tags --abbrev=0
incoming = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' ..@{u})
outgoing = !(git fetch --quiet && git log --pretty=format:'%C(yellow)%h %C(white)- %C(red)%an %C(white)- %C(cyan)%d%Creset %s %C(white)- %ar%Creset' @{u}..)
unstage = reset HEAD --
undo = checkout --
rollback = reset --soft HEAD~1
## Aliases for PR's
preparepr = "!f() { BRANCH=$(git rev-parse --abbrev-ref HEAD);git checkout master; git fetch && git rebase; git checkout \"$BRANCH\";git rebase master; }; f"
updatepr = "!f() { BRANCH=$(git rev-parse --abbrev-ref HEAD);git push origin \"$BRANCH\":\"$BRANCH\";}; f"
## Update the org
openpr = "!f() { BRANCH=$(git rev-parse --abbrev-ref HEAD); REPO=$(git ls-remote --get-url | cut -d / -f2 | cut -d . -f1) ;git push --set-upstream origin \"$BRANCH\":\"$BRANCH\"; echo -e \"https://github.com/deco-sites/$REPO/compare/$BRANCH?expand=1\";}; f"
## Aliases that match the hg in / out commands
in = "!f() { BRANCH=$(git rev-parse --abbrev-ref HEAD);git fetch && git log ..origin/\"$BRANCH\"; }; f"
out = "!f() { BRANCH=$(git rev-parse --abbrev-ref HEAD);git fetch && git whatchanged origin/\"$BRANCH\"..; }; f"
[merge]
tool = code
rebase = true
[pull]
rebase = true
[branch]
autosetuprebase = always
[branch "master"]
rebase = true
[core]
eol = lf
autocrlf = input
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment