Basics

of

 

What Exactly Is GitHub Anyway?

 

What is GitHub?


  • GitHub is Git repository hosting service - started by Linux creator Linus Torvalds

  • GitHub is special





  • version control software (VCS)
  • manages changes to a project without overwriting any part of that project

DVCS

How Git Works

  • You modify files in your working directory.
  • You stage the files, adding snapshots of them to your staging area.
  • You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
 

Let's Get Started Now!

First-Time Git Setup








  • Windows: http://windows.github.com/


  • Linux-based OS: http://git-scm.com/download/linux


Open the terminal and use the following command:
sudo apt-get install git

Git Config


  • Set your user name and e-mail address
$ git config --global user.name "Muhammad Sumon Molla Selim"
$ git config --global user.email "me@sumonselim.com"


  • Check your settings
$ git config --list

  • For help
$ git help config

Creating an online repository on GitHub

Creating Your Local Repository


  • Create your project directory
  • Open your terminal
  • Enter the directory
  • Run command:
$ git init

Cloning An Existing Repository

  • Run the following command
$ git clone https://github.com/smseleem/try_git.git 


Checking Status of Your Files


  • Type
$ git status
  • If no file changes found
On branch master
nothing to commit, working directory clean
  • If file changes found
On branch master
Untracked files:
  (use "git add <file>" to include in what will be committed)

Tracking Your Files


  • To begin tracking files
$ git add <file_name>
  • To see the changes, run
$ git status
  • To know exactly what you changed, run
$ git diff

Committing Your Changes


  • The simplest way to commit is to type
$ git commit
  • You can type your commit message inline
$ git commit -m "Your commit message"
  • Skipping the staging area

$ git commit -a -m "Your commit message"

Connect Local Repository To  GitHub 


  • Let Git know about your remote repository
$ git remote add origin https://github.com/smseleem/try_git.git
  • To confirm, type this to check
$ git remote -v 
  • Upload, or “push,” our changes up to the GitHub remote repo
$ git push 


In a nutshell...


$ git init
$ git status
$ git add *
$ git commit -m "initial commit"
$ git remote add origin https://github.com/smseleem/try_git.git
$ git remote -v
$ git push

Resources


  • http://www.codeschool.com/courses/try-git
  • http://git-scm.com/book
  • http://rogerdudler.github.io/git-guide
  • http://gitref.org/

About Me


Muhammad Sumon Molla Selim

Founder, Lets Learn Coding
Software Architect, Kodeeo

http://www.sumonselim.com

http://www.letslearncoding.org

Basics of Github

By Muhammad Sumon Molla Selim

Basics of Github

Getting started with GitHub

  • 2,469