- git status - list untracked/modified/deleted files
- git diff - To show line by line uncommitted local code changes
- git show - To show diff of last commit
- git add <filename> - To add file to be commit
- git rm <filename> - To remove deleted file from git tracking
- git commit - To commit the changes in local branch
- git commit --amend - To append changes to peviously made commit
- git push origin <branchname> - To push commit to remote (github)
- git push origin HEAD - To push current branch to remote (github)
- git pull origin <branchname> - To pull latest commits from remote branch (github)
- git branch - To see current branch
- git checkout <branchname> - To switch to another branch
- git checkout -b <branchname> - To create and switch to new branch
- git branch -D <branchname> - To delete a branch locally
- git reset --hard - To clear local changes
- git reset --hard HEAD^ - To delete last commit
- git revert <commit-id> - To revert commit
- git rebase -i HEAD~5 - To squash last 5 commits into single commit
- git rebase -i --root - To squash all commits into root commit