- Git Aliases Reference 1
- Git Aliases Reference 2
- Git Aliases Reference 3 - Medium Blog
- My
~/.gitconfig
[alias]
st = status
pu = config user.email "makrandapatil17@gmail.com"
pu2 = config user.id "makrandp"
- git add
filename
- git rm --cached
filename
(this will remove file after the commit)
- git reset HEAD --
filename
- git checkout --track origin/branch-name
- git checkout -- .
- git checkout --
path/to/file
- git rm
- git rm -f
- git rm --cached
- git log --oneline
- git log --oneline --graph --decorate --all
- git log --author="John Doe"
- git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --author="Mak Patil"
- git merge --no-ff
- Have you ever started working on a branch, making changes, but you change your mind and want to completely start over? Use this command to remove any changes and reset the branch to a clean state.
git reset --hard HEAD
- if you have commit hash and you want to see all the code put in for that commit
git show 4ce75a333a29f1aafc4817dd8cb128d3e852572f
- if there is a branch which is available remotely but not available locally. to checkout remote branch
git checkout -b branchName origin/branchName
- if you merged your feature branch(not pushed the commit to origin) and now decide to undo that recent merge