Skip to content

Instantly share code, notes, and snippets.

Last active February 25, 2023 06:04
What would you like to do?

Configure Git Username/Email


git config --global "FirstName LastName"
git config --global ""

# To verify the global configuration, run:
git config --list


# Locally (per repo)
git config "FirstName LastName"
git config ""

# To verify the local configuration, run:
cat .git/config

Configure Git Aliases

# To display the list of aliases you currently have, run:
git config --get-regexp alias

# To remove an alias, run:
git config --global --unset alias.aliasName


# Alias 1 (Git status)
# Usage: git st
git config --global status


# Alias 2 (Stage all changes and commit)
# Usage: git adc -m "Commit message"
git config --global alias.adc '!git add -A && git commit'


# Alias 3 (Show history)
# Usage example: git lol
# Usage example: git lol -5
git config --global 'log --graph --decorate --pretty=oneline --abbrev-commit'

Configure Git Aliases in .bash_profile

nano ~/.bash_profile

alias gb="git branch"
alias gc="git checkout"
alias gp="git pull"
alias gs="git status"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment