Using GitHub

GitHub is an open source version control system (VCS) called Git*. Created by the same team that created Linux.

Using Git Hub on other platforms like Windows or Linux has no such difference you just need to download the respective binaries for your platform with platform dependent Git.

Here are some steps you need to use Git Hub:

Setting Up Git Hub

  1. Download Git Hub for windows (check above links for other platform): http://github-windows.s3.amazonaws.com/GitHubSetup.exe
  2. Download Git: http://git-scm.com/download/win
  3. Create an account on Git Hub
  4. Open Git Shell or use Git GUI
  • Using Git Shell:
    1. git config –global user.name “Your Name Here”
    2. git config –global user.email your_email@example.com
    3. Done

 Create a Repo

  1. Go to this url to create a new repo https://github.com/repositories/new
  2. Put a name for a repo and create it. (this is on remote server)
  3. Done

 Setup a local git

  1. Open Git Shell
  2. Change path to working directory (Assuming you have some working directory)
  3. Type git init
  4. Done

Commit your code

  1. Add files to your local git. git add someFile.someExt or git add some directory
  2. git commit –m “Some description what has been commit and why”
  3. Done

Push your commits to remote

  1. git remote add origin https://github.com/username/name-of-your-working-git.git
  2. git push origin master
  3. Checkmate! // Note that “origin” is a remote name

 Forking a repo

  1. Go to a project page
  2. Click on fork button
  3. Clone this project to local by running: git clone https://github.com/your-username/recently-added-git.git
  4. This will add to current working directory

 Up-streaming a git

  1. Go to project directory using shell
  2. git remote add upstream https://github.com/octocat/Spoon-Knife.git (forked git url)
  3. git fetch upstream

Pull in up-stream changes

  1. git fetch upstream
  2. git merge upstream/master

Creating a Branch

  1. git branch mybranch
  2. git checkout mybranch
  • or
  1. git checkout -b mybranch

To switch

  1. git checkout master
  2. git checkout mybranch

Merging back the branch

  1. git checkout master
  2. git merge mybranch
  3. git branch -d mybranch
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s