Useful Git Commands

The distributed version control Git is an ultimate solution for managing and maintaining collaborative software development environment. It is really handy to remember useful git commands while development. Following are some useful git commands:

Git config

git config --list
This command will show user's settings.

Git diff

git diff --cached
This command will show non-committed changes. 

Git branching

git branch -a
This command will show the list of all branches of local and remote repository.

Git history

git show <hash>
This command will show all the changes in the last commit
git show <hash> --name-only
This command will show all the file changes in the last commit

Git remove remote branch

git push origin --delete <branch-name>

Git remove local branch

git branch --d <branch-name> # Shorter version
git branch --D <branch-name> # Force delete un-merged branches

Comments