Git aliases simplifying common or odd tasks.
- Edit your .gitconfig file
- C:\Users\%USERNAME%\.gitconfig
- Under the [alias] section
- git alias command
- git config --global alias."alias name" "command1; command2; command3"
- Ex.
- git config --global alias.atomic '!f() { git add . && git commit -am "$1" && git push; }; f'
add untracked files, commit, and push.
- Usage
- git atomic "Title" "Message"
- Install Command
-
git config --global alias.atomic '!f() { git add . && git commit -am "$1" && git push; }; f'
Clears all local changes and pulls the latest version of the current branch.
- Usage
- git fresh
- Install Command
-
git config --global alias.fresh '!f() { current_branch=$(git rev-parse --abbrev-ref HEAD); git reset --hard; git fetch origin; git checkout $current_branch; git pull origin $current_branch; }; f'