Skip to content

Instantly share code, notes, and snippets.

@rhcarlosweb
Last active November 25, 2024 17:24
Show Gist options
  • Select an option

  • Save rhcarlosweb/6f24a88defc2a56cf7e61d5543c2ed2a to your computer and use it in GitHub Desktop.

Select an option

Save rhcarlosweb/6f24a88defc2a56cf7e61d5543c2ed2a to your computer and use it in GitHub Desktop.
GitConfig Alias
[alias]
# Shorthand for checkout
co = checkout
# Shorthand for branch
br = branch
# Shorthand for commit
ci = commit
# Shorthand for status
st = status
# Hide file from Git tracking
hide = update-index --assume-unchanged
# Unhide previously hidden file
unhide = update-index --no-assume-unchanged
# Remove file from staging area
unstage = reset HEAD --
# Show last commit
last = log -1 HEAD
# Shorthand for push
ps = push
# Add all changes and commit with message
ca = !git add -A && git commit -m
# Show all branches including remote
ba = branch -a
# Show detailed status
stat = status -sb
# Show commit history with graph
lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
# Undo last commit but keep changes
undo = reset HEAD~1 --soft
# Show diff of staged changes
ds = diff --staged
# Pull with rebase
pr = pull --rebase
# Push force with lease (safer than force push)
pf = push --force-with-lease
# List all aliases
alias = config --get-regexp ^alias\\.
# Amend commit without editing message
amend = commit --amend --no-edit
# Clean untracked files and directories
cleanup = clean -fd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment