PDC - Meetup Session

30th July 2016

@GS labs

Swapnil kalhapure a.k.a. Scifiswapnil



Git, Git-hub & hosting gh-pages

  • Introduction & basics.
  • Git basic Concepts.
  • Repositories.
  • GitHub and features.
  • gh-pages.
  • Jekyll and git blogs.



Version Control Systems


Revision Control Systems


Source Control Systems

Source : img src

Local VCS


Source : Github doc

Distributed VCS

 {Git }

Central VCS

Source : Github doc

  • Speed

  • Simple design

  • Strong support for non-linear development 

  • Fully distributed

  • Able to handle large projects like the Linux kernel efficiently (speed and data size)


Source : Github doc


The main reference :      https://git-scm.com/

30 mins Crash course :  https://try.github.io/

Other References :         https://www.atlassian.com/git/


Github Resources :         https://enterprise.github.com



Git fundamentals

Snapshots, Not Differences

Most VCS do :

: What Git does

Source : Github doc

Git fundamentals

  • Nearly Every Operation Is Local
    • Only need local files and resources to operate.
    • Offline use.


  • Git Has Integrity
    • Everything in Git is check-summed
    • "24b9da6552252987aa493b52f8696cd6d3b00373"


  • Only Adds Data
    • add data to the Git database


Source : Github doc

Git fundamentals

The Three States

Source : Github doc


Git Installations

  • Command Line
  • Graphical user interface 

Installing CL-Git

For Linux Users : 

$ sudo apt-get install git-all
$ sudo yum install git-all

Fedora Users

Ubuntu Users

Source : Github doc

Installing CL-Git

For Windows Users : 

For Mac Users : 

Source : Github doc

Installing GUI-Git

GitHub Desktop

Platforms: Windows, Mac
Price: Free


Platforms: Windows, Mac, Linux
Price: Free

Source : Github doc

Lets get started..!

Git - Flow

Flow of git commands and repos

Source : Blog

Adding Files

$ git add <list of files>
$ git add -all / -A
$ git add *.doc
$ git add "*.cpp"

Adding list of files

Adding all files

Adding files with extensions

Adding all files with specific extensions in a directory

Removing Files

removing list of files from the staging area

$ git reset HEAD <file>

Source : Blog


ACID Commits

  • Atomic 
  • Consistent
  • Incremental 
  • Documented

Source : Blog

Git Commits

Making commits on a repo

$ git commit -m "message related to commit"

Source : Blog

$ git commit -a
$ git commit

Commit everything

one line commit with message

After commits

$ git reset --soft HEAD^
$ git commit --amend 
$ git reset --hard HEAD^
Undo last commit, put changes to staging
Change the last commit
Undo last commit and all changes

Overall Scenario

Source : Blog



Know your past, to get ready for the future..

$ git log --since=date --until=date

display's log with all commits till date

display's log with all commits from date - till date

$ git log 

display's log with all commits ewith formating

$ git log --pretty=

Get back to past




$ git checkout {commit}
$ git revert {commit}
$ git reset {commit}

Remove files from staging area

$ git reset {commit} -hard

Remove files from staging area

and working directory.

undo a commit

get to commit

Git Diff's

Making difference....

$ git diff --staged

Difference between staged changes and working directory

Difference between staged changes and last commit

$ git diff

Difference between commits

$ git diff {commit} {commit}
$ git diff HEAD

Difference between current state and last commit

Source : Blog


The "Social Media" for developers

Source : Blog

"Competition makes us faster, Collaboration makes us better"

Source : Blog

Life at Github is all about 




Harmonize with GitHub




$ git fetch {remote}
$ git pull {remote}
$ git push {remote}

update remote repo

get a repo

fetch a repo

$ git fetch {remote} {branch}
$ git pull {remote} {branch}
$ git push {remote} {branch}

Something that makes it Git Great..!

Source : Photo




Source : Blog


Git Branching 

Source : Photo

Git Branching 

Lets Branch

$ git branch {branch name}

Display list of all branch

Create a branch

$ git branch

Create and switch in one go

$ git checkout -b {branch name}
$ git checkout {branch name}

Switch to a branch

Show branch details

$ git remote show origin

Removing a branch 

$ git branch -d {branch name}

remove a branch

$ git branch -D {branch name}

remove a branch forcefully

$ git push origin :{branch name}

Delete a remote branch

Git Merging

Source : Photo

How it works

Source : Blog

How its done

$ git checkout {branch name}

Swtich to branch where you have to merge

$ git merge {branch name}

Merge with the branch you want

Source : Photo

Merge Conflict

Source : Photo

Resolving merge conflicts

Source : Photo

Source : Photo


Source : Photo

Source : Photo

Golden Rule

The golden rule of git rebase is to never use it on public branches.

Source : Blog



Project pages

  • One descriptional page
  • In same project repo 
  • New branch "gh-pages"
  • add as sub-domain to your domain
  • Simple and large set of templates available 

Organizational pages

  • A fully functional static website.
  • Dedicated repo 
  • All commits on master
  • Use Jekyll 
  • Jekyll pulgins to make website dynamic and optimized

Creating Pages manually

$ git branch ph-pages

Clone a repo

Create a branch : "gh-pages"

$ git clone {renmote}
$ git checkout gh-pages

Switch to a branch

$ git add .
$ git commit -m "message"
$ git push origin gh-pages

add, commit and push

Live world wide

Designing Pages

HTML + CSS + MarkDown


Orgranizational Pages

Clone a repo

$ git clone {remote}
$ git add .
$ git commit -m "message"
$ git push origin master

add, commit and push to main branch

Using Jekyll as web generator

What is Jekyll ??

  • Simple
  • Static
  • Blog aware
  • WebSite Generator
  • Free with GitHub

Installing Jekyll and a Quickstart

~ $ gem install jekyll

~ $ jekyll new Meri-Website

~ $ cd Meri-Website

~/Meri-Website $ jekyll serve
    # => Now browse to http://localhost:4000
  • Ruby (including development headers, v1.9.3 or above for Jekyll 2 and v2 or above for Jekyll 3)
  • RubyGems
  • Linux, Unix, or Mac OS X
  • NodeJS, or another JavaScript runtime (Jekyll 2 and earlier, for CoffeeScript support).
  • Python 2.7 (for Jekyll 2 and earlier)



├── _config.yml
├── _drafts
|   ├── begin-with-the-crazy-ideas.textile
|   └── on-simplicity-in-technology.markdown
├── _includes
|   ├── footer.html
|   └── header.html
├── _layouts
|   ├── default.html
|   └── post.html
├── _posts
|   ├── 2007-10-29-why-every-programmer-should-play-nethack.textile
|   └── 2009-04-26-barcamp-boston-4-roundup.textile
├── _data
|   └── members.yml
├── _site
├── .jekyll-metadata
└── index.html

Jekyll Directory Structure

Source : Blog


PDC - Meetup Session

30th July 2016

@GS labs

Swapnil kalhapure a.k.a. Scifiswapnil



Git, Git-hub & hosting gh-pages

Git, GitHub and gh-pages

By Swapnil Kalhapure

Git, GitHub and gh-pages

Introduction to Git, Github and Gh-pages

  • 1,205
Loading comments...

More from Swapnil Kalhapure