Thursday, March 18, 2021

Git Command [Working Directory to Local Repository]


  1. cd to your local directory
  2. git init : Initialised git   
  3. ls -a : to view all the hidden files
  4. git status : to check what files are inside the staging area
  5. git add [filename.txt] : add files to the staging area
  6. git rm —cached -r : to remove everything from the staging area
  7. git status: to check what files are inside the staging area 
  8. git commit -m “initial files” : commit files in the version control  
  9. git log : see what commit has been made        

[If there is edits made to the files]
  1. cd to your local directory
  2. git status : to check what files are inside the staging area
  3. git add . : add all files to the staging area
  4. git status : to check what files are inside the staging area
  5. git commit -m “initial files” : commit files in the version control  
  6. git log : see what commit has been made
  7. git diff [filename] : see what difference between current version and last save point     
  8. git checkout [filename]:rollback to the previous versiong

[Compare the codes of your files in your working directory]
  1. cd to your directory you have committed
  2. git add . : git add all files
  3. git diff . : check the difference between current version and last save point

No comments:

Post a Comment