Skip to content

Git Commands

NaNaDi edited this page Apr 13, 2018 · 5 revisions

Initialization

git clone <URL> - clone a repository from github to your local computer

After completed an exercise

git add <FilesToAdd> or git add . - add your changes to your local repository
git commit -m '<CommitMessage>' - commit your changes and write a brief commit message
git push - push your changes to your github repository

Useful commands

git checkout -b <Branchname> - create a new branch and switch to it
git push origin <Branchname> - push your created branch to github
git branch - check on which branch you are working right now
git checkout <Branchname> - switch branches
git status - check status of your repository (very helpful before calling git add)
git help - provides some helpful commands

Keeping your Repository up to date

Initialization

git remote add upstream https://github.com/NaNaDi/Programming_Tutorial.git

Refreshing

git fetch upstream
git merge upstream/master

Clone this wiki locally