Skip to content

Instantly share code, notes, and snippets.

@carrieforde
Created April 20, 2017 20:20
Show Gist options
  • Save carrieforde/93937f5177f5eade3dce95d0449bb746 to your computer and use it in GitHub Desktop.
Save carrieforde/93937f5177f5eade3dce95d0449bb746 to your computer and use it in GitHub Desktop.
Git Basics
git init # initialize a new repo
git clone <remote repo> <directory name> # clone an existing repo to your machine
git status # see what files have been modified or added, if you’ve fetched recently, check where your local is in relation to the remote
git add <file or directory>, git add -A # if you want to choose with files to add, use git add <file>, otherwise, git add -A will stage everything that has new or has been modified
git commit -m “<message>” # commit your staged files
git fetch <remote> <remote branch> # fetch any changes on remote. Both the remote name and remote branch are optional. Use in conjunction with git status
git pull <remote> <remote branch> # pull the latest version of the remote to your local
git push <remote> <remote branch> # push your local changes to the remote (you may need to set up your remote first!)
git remote add <remote name> <remote repo> # set up a remote repo
git remote rm <remote name> # remove a remote repo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment