Basic commands that are used in GIT

GITBasic Commands used in GIT

Here I’m listing all basic Commands used in GIT bash.

  1. git –version: Tells you about version
  2. git –global Page on user.name “Code Hotfix” : Register user name
  3. git –global user.email “codehotfix@github.com” : Register user email
  4. git config –list : Git Config
  5. git help / git help command : Git help
  6. pwd : Gives you the working directory of repository 
  7. cd .. : To go back
  8. ls : Gives you all folder
  9. cd nameOfFolder : To move to the specified folder
  10. git init : To make folder as a git repository (First move into the folder to make it as a repository)
  11. ls -la : Gives you the list of folder in repository that keep record of changes
  12. 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
  13. git commit -m “Expressing the detail about change ” : This will commit the changes with the note
  14. git log : Gives you the commit history
  15. git log –author=”CodeHotfix” : Gives you commit history of specific author
  16. git status : Gives you the status of pending changes.
  17. git diff : Give you the difference of working directory and repository
  18. git diff –staged : Compare staged  area with repository
  19. git rm filename : Removes the file from repository as well as working directory
  20. git mv oldname to newNAME : Also rename the file
  21. git mv oldname to newPATH/newNAME : Also rename the file and move to the new path
  1. git commit -am “Commit message” :Directly commit to the repository without adding to the staging area
  2. git checkout — Views/Home/Index.cshtml : Undo Pending Changes
  3. git reset HEAD filename  : Unstage the file to the working area
  4. git checkout refrenceumber — file/folder : Get the previous version copy of specified file

You can also read Understanding GIT and GitHub 

Enjoy.. !!

Leave a Reply

Your email address will not be published. Required fields are marked *