Guest User

Untitled

a guest
Feb 20th, 2018
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.46 KB | None | 0 0
  1. # Git Cheat Sheet
  2. How to clone a repo using SSH from github, make changes and push the changes back to the master branch.
  3.  
  4. ### cloning a repo from github
  5. - `git clone <git@github.com:username/foldername.git>` copy the SSH link option from GitHub for the specific repo you want to copy
  6. - `ls -la` list all the files inside the directory so it can be reviewed
  7. - `cd <foldername>` change directory to be inside the folder you just cloned
  8. - `subl .` open the project folder in sublime
  9. - Now, you can make changes to the file.
  10.  
  11. ### adding files back to repo: commit & synchronize
  12. - `git add .` adds all modified and new (untracked) files in the current directory and all subdirectories to the staging area (a.k.a. the index), thus preparing them to be included in the next git commit.
  13. - `git commit -m '<message>'` commit file
  14. - `git push origin master` push changes to remote repo (GitHub)
  15.  
  16. ### copying and moving files and folders
  17. - `cp <filename> /<foldername>` copy a file in the current working directory to another folder/directory
  18. - `cp * /<foldername>` copy all files inside the current working directory to another folder/directory
  19. - `cp -R * /<foldername>` copy a directory including all its files and subdirectories to another folder/directory
  20.  
  21. ### pull request from GitHub
  22. - `cd <foldername>` go to the folder you want to pull the changes into (original repo)
  23. - `git pull` pull the changes from GitHub
  24. - `subl .` open the entire repo/folder in Sublime Text editor
Add Comment
Please, Sign In to add comment