Skip to content
Christopher Strøm edited this page Nov 1, 2020 · 3 revisions

Useful git commands

Command Description
git clone <repository> Adds copy of <repository> to current folder
git pull Updates local repository with changes from github repository
git branch Lists all local branches
git branch <name> Creates new branch called <name>
git branch -D <branch> Delete <branch> locally
git checkout <branch> Switches branch to <branch>
git checkout --track origin/<branch> Creates a local copy of <branch> from github, and switches to it
git add <file> Add changes made to <file>
git add . Add all changes
git commit -m "<message>" Commit added changes to branch, with commit message <message>
git push Push commits made to local branch to connected branch on github
git push --set-upstream origin <branch> Connects local branch with <branch> on github

Quick video on the basics: https://www.youtube.com/watch?v=USjZcfj8yxE

And the notes to the video: https://www.notion.so/Introduction-to-Git-ac396a0697704709a12b6a0e545db049

Cool blog post (but don't push to master): http://rogerdudler.github.io/git-guide/