Skip to content

hy2450/Tutorial_GitHub

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

###GitHub Tutorial

Installation:

Initialization:

  • Create a new empty repository
    • create through github desktop
    • create through github website
    • create through terminal: cd to a new director and git init
  • Create a repository from existing local folder
    • from desktop: drag the folder to github desktop
    • from terminal: cd to existing folder and git 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 on GitHub Desktop

  • Work in local repository
    • Add/Change files
    • Commit to local repository
    • Push to remote repository
    • Pull to local repository
  • Work with collaboration
    • Fork and clone a (master) repository
    • Create a branch
      • Branching is the way to work on different parts of a repository at one time. It creates a snapshot of the original branch.
      • branch demo
    • Make a commit
    • Open a pull request
    • Merge pull request into the master branch
    • Pull to local repository

Work on GitHub with terminal

  • Work in local repository
    • Add/Change files: git add <filename> or git add -A if you want to add all files
    • Commit to local repository: git commit -m "Commit message"
    • Push to remote repository git push
  • 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>
  • A brief guide: http://rogerdudler.github.io/git-guide/

Git Glossary

  • 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

github demo

Workflow

workflow demo

*source:http://rogerdudler.github.io/git-guide/ *

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • R 100.0%