Git Commands Cheatsheet
Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
Git is easy to learn and has a tiny footprint with lightning fast performance. It outclasses SCM tools like Subversion, CVS, Perforce, and ClearCase with features like cheap local branching, convenient staging areas, and multiple workflows. [git-scm.com]
- git init : Create a new Git repository
- git clone : Clone a repository
- git status : Show state of current directory
- git log : List the commithistory
- git diff : diff b/w working directory & index
- git show : Display the contentand metadata
- git branch : List all branches in the repostiry
- git checkout [branch] : Switch to a branch
- git branch -d : Delete a Branch
- git branch -m : Rename a branch
- git merge [branch] : Merge the specified branch
- git add [file] : Stage changes
- git add . : Stage everything
- git revert [file] : Undo changes
- git clean -n : Show untracked files
- git commit –amend : Replace the last commit
- git remote : add connection to a remote repository
- git pull : Fetch a repository
- git push : Push a branch
- git config –global user.name : Define the authorname to be used
- git reset : Reset staging area to match mostrecent commit
- git fetch <remote> <branch> : Fetches a specific, from the repo