###GitHub Tutorial
- Install Git: http://git-scm.com/downloads (Windows & OS X)
- Install GitHub Desktop: https://desktop.github.com/
- Create a new empty repository
- create through github desktop
- create through github website
- create through terminal:
cd
to a new director andgit init
- Create a repository from existing local folder
- from desktop: drag the folder to github desktop
- from terminal:
cd
to existing folder andgit init
. Commit and push all the files/changes (see below).
- Create a new R project in Studio with Git version control
- Fork and Clone an existing git repository
- from desktop
- from terminal:
git clone username@host/path/to/repository
- Work in local repository
- Add/Change files
- Commit to local repository
- Push to remote repository
- Pull to local repository
- Work with collaboration
- Work in local repository
- Add/Change files:
git add <filename>
orgit add -A
if you want to add all files - Commit to local repository:
git commit -m "Commit message"
- Push to remote repository
git push
- Add/Change files:
- Work with collaboration
- Create a branch:
git checkout -b <branchname>
- Switch back to master:
git checkout master
- Make a commit and push to repository:
git push origin <branchname>
- update local repository to newest commit:
git pull
- Merge another branch into you active branch:
git merge <otherbranchname>
- Create a branch:
- A brief guide: http://rogerdudler.github.io/git-guide/
- commit: record your changes to the local repository.
- push: update the remote repository with your local changes.
- pull: update your local repository to the newest commit
- fork: a request for GitHub to clone the project and registers it under your username; GitHub also keeps track of the relationship between the two repositories, so you can visualize the commits and pulls between the two projects (and other forks).
- clone: copy a repository into your local directory
- branch: branches allow you to build new features or test out ideas without putting the main project (master) at risk.
- merge: combine another branch in to the master
- checkout: switch between branches
*source:http://rogerdudler.github.io/git-guide/ *