Basic Commands used in GIT
Here I’m listing all basic Commands used in GIT bash.
- git –version: Tells you about version
- git –global Page on user.name “Code Hotfix” : Register user name
- git –global user.email “codehotfix@github.com” : Register user email
- git config –list : Git Config
- git help / git help command : Git help
- pwd : Gives you the working directory of repository
- cd .. : To go back
- ls : Gives you all folder
- cd nameOfFolder : To move to the specified folder
- git init : To make folder as a git repository (First move into the folder to make it as a repository)
- ls -la : Gives you the list of folder in repository that keep record of changes
- git add . : To aware git to add the file in the directory it adds to the staging area (. Means all) you can replace (.) With file name like second.txt
- git commit -m “Expressing the detail about change ” : This will commit the changes with the note
- git log : Gives you the commit history
- git log –author=”CodeHotfix” : Gives you commit history of specific author
- git status : Gives you the status of pending changes.
- git diff : Give you the difference of working directory and repository
- git diff –staged : Compare staged area with repository
- git rm filename : Removes the file from repository as well as working directory
- git mv oldname to newNAME : Also rename the file
- git mv oldname to newPATH/newNAME : Also rename the file and move to the new path
- git commit -am “Commit message” :Directly commit to the repository without adding to the staging area
- git checkout — Views/Home/Index.cshtml : Undo Pending Changes
- git reset HEAD filename : Unstage the file to the working area
- git checkout refrenceumber — file/folder : Get the previous version copy of specified file
You can also read Understanding GIT and GitHub
Enjoy.. !!