Skip to content

Instantly share code, notes, and snippets.

@leosvelperez
Last active October 22, 2022 17:11
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leosvelperez/8dfea5c5c620a72adb5980a32f09feb2 to your computer and use it in GitHub Desktop.
Save leosvelperez/8dfea5c5c620a72adb5980a32f09feb2 to your computer and use it in GitHub Desktop.
Useful Git aliases
[alias]
a = add
ap = add -p
bd = branch -D
# Removes branches already merged
bdm = "!git branch --merged | grep -v '*' | xargs -n 1 git branch -d"
c = commit
cm = commit -m
co = checkout
cob = checkout -b
f = fetch -p
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --branches
p = push
pf = push --force
rba = rebase --abort
rbc = rebase --continue
rb = "!git fetch origin main:main && git rebase main"
rbdevelop = "!git fetch origin develop:develop && git rebase develop"
rbmaster = "!git fetch origin master:master && git rebase master"
rlc = reset HEAD~
sf = "!git fetch --all --tags && git checkout main && git merge upstream/main && git push origin main --tags"
sfmaster = "!git fetch --all --tags && git checkout master && git merge upstream/master && git push origin master --tags"
st = stash
std = stash drop
stl = stash list
stp = stash pop
s = status -sb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment