Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.