Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Git Cheat Sheet
- How to clone a repo using SSH from github, make changes and push the changes back to the master branch.
- ### cloning a repo from github
- - `git clone <git@github.com:username/foldername.git>` copy the SSH link option from GitHub for the specific repo you want to copy
- - `ls -la` list all the files inside the directory so it can be reviewed
- - `cd <foldername>` change directory to be inside the folder you just cloned
- - `subl .` open the project folder in sublime
- - Now, you can make changes to the file.
- ### adding files back to repo: commit & synchronize
- - `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.
- - `git commit -m '<message>'` commit file
- - `git push origin master` push changes to remote repo (GitHub)
- ### copying and moving files and folders
- - `cp <filename> /<foldername>` copy a file in the current working directory to another folder/directory
- - `cp * /<foldername>` copy all files inside the current working directory to another folder/directory
- - `cp -R * /<foldername>` copy a directory including all its files and subdirectories to another folder/directory
- ### pull request from GitHub
- - `cd <foldername>` go to the folder you want to pull the changes into (original repo)
- - `git pull` pull the changes from GitHub
- - `subl .` open the entire repo/folder in Sublime Text editor
Add Comment
Please, Sign In to add comment