SlideShare a Scribd company logo
Workflow
an opinionated discussion
Grad Student, MIMS’14
Shreyas
seekshreyas
some slides adopted from and inspired by Scott Schacon’s
https://github.com/schacon/git-presentations
We’ve all been here ...
We’ve all been here ...
We’ve all been here ...
Problems
• multiple versions
• many contributors
• ...
conflicts
git + Github
a better workflow
git
git is an open source,
distributed version control
system designed for speed
and efficiency
git
git is an open source,
distributed version control
system designed for speed
and efficiency
git
git is an open source,
distributed version control
system designed for speed
and efficiency
git
git is an open source,
distributed version control
system designed for speed
and efficiency
(almost) everything is local
No Network needed for
(almost) everything is local
• Performing a diff
• Viewing file history
• Committing changes
• Merging branches
• Obtaining any other revision of a file
• Switching branches
git
git is an open source,
distributed version control
system designed for speed
and efficiency
http://bit.ly/git-linus-intro
ttp://bit.ly/git-advantages
More Advantages
.. and
• No .svn directories
• Independence
installing git
http://git-scm.com/downloads
getting setup ...
$ git config --global user.name
ā€œ<YOUR_NAME>ā€
$ git config --global user.email
ā€œ<YOUR_EMAIL>ā€
or edit them in ~/.gitconfig
lets dive in..
gitref.org/
• Creating New Repo
• Committing
• Branching/Merging
• InspectionCloning a
RepoUpdating
lets dive in..
• Creating New Repo
• Committing
• Branching/Merging
• Inspection
• Cloning a Repo
• Updating
http://git-scm.com/docs
Git Commands
$ git init
$ ls -al
$ git init
$ ls -al
$ mkdir workspace
$ cd workspace
Initialized empty Git repository in
../workspace/.git/
drwxr-xr-x 10 Shreyas staff 340 Jan 15
17:22 .git
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
Git Commands
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
$ cd .git
$ tree -a
Git Commands
$ git status
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
$ cd ..
$ touch testfile.md
branch
name
staging area
Git Commands
$ git add
<filename>
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
staging area
$ git status
Git Commands
$ git commit
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
your commit
msg
$ git status
Git Commands
$ git reset
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
(undo add)
changes staged
changes
unstaged
Git Commands
$ git reset --soft HEAD^
• Creating New
Repo
• Committing
• Branching/
Merging
• Updating
• Inspection
• Cloning A Repo
(undo a commit and
redo)
$ git reset --hard
HEAD~3
Rewind the branch to get rid of last three commits
http://git-scm.com/docs/git-r
eset
http://git-scm.com/docs/git-rev
ert.html
learn more here :
also refer
git revert :
http://git-scm.com/docs/git-sta
sh
git stash :
Git Commands
$ git rm <filename>
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
remove a file from the
repo
as expected, you will need to commit the
change
$ git mv <filename>
move/rename a file from the repo
as expected, you will need to commit the
change
Git Commands
$ git branch
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
list of branches
$ git branch
<branchname>
new branch
$ git checkout
<branchname>
switch
Git Commands
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
new branch
dev
switch branch
branch list
Git Commands
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
$ git merge
<branchname>
merge
branches
branch merge
Git Commands
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
$ git log
--graph
--decorate
--abbrev-commit
--all
--pretty=oneline
text-based graph :)
Git Commands
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
~/.gitconfig
[alias]
l = log --pretty=oneline -n 20 --
graph
Git Commands
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
$ gitk
Working with others...
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
github
GitHub
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
create an account
www.github.com/edu
GitHub
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
add ssh key
www.github.com/edu
GitHub
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
$ git clone <url>
<name>
https://github.com/jblomo/
datamining290
GitHub
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
Fork a repo
GitHub
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
$ git pull
$ git push
= git fetch + git merge
GitHub
• Creating New
Repo
• Committing
• Branching/
Merging
• Inspection
• Cloning a Repo
• Updating
GitHub Pull Request
GitHub Ninja Features
Markdown for documentation
Pages for project hosting
Gist for project hosting
Service Hooks ā€˜do something’ on commit
may the Force be with you

More Related Content

Similar to Distributed Version control using Git and Github (20)

PDF
Git: a brief introduction
Randal Schwartz
Ā 
PPTX
Intro to git and git hub
Venkat Malladi
Ā 
PDF
Git Init (Introduction to Git)
GDSC UofT Mississauga
Ā 
PPTX
11 git version control
Wasim Alatrash
Ā 
PPT
Git presentation
James Cuzella
Ā 
PDF
Source Code Management with Git
Things Lab
Ā 
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
Ā 
PPTX
Git_new.pptx
BruceLee275640
Ā 
PPTX
sample.pptx
UshaSuray
Ā 
PPT
390a gitintro 12au
Nguyen Van Hung
Ā 
PDF
Did you git yet?
Michael Fong
Ā 
PPTX
Git 101 - An introduction to Version Control using Git
John Tighe
Ā 
PPT
Fundamentals and basics of Git and commands
DivyanshGupta922023
Ā 
PPT
Git and fundamentals
Naincy Gupta
Ā 
PDF
Collaborative development with Git | Workshop
Anuchit Chalothorn
Ā 
PPTX
Git
Shinu Suresh
Ā 
PDF
GIT Basics
Tagged Social
Ā 
PDF
Advanced Git Tutorial
Sage Sharp
Ā 
PDF
Git slides
Nanyak S
Ā 
PPTX
Git workshop
Ray Toal
Ā 
Git: a brief introduction
Randal Schwartz
Ā 
Intro to git and git hub
Venkat Malladi
Ā 
Git Init (Introduction to Git)
GDSC UofT Mississauga
Ā 
11 git version control
Wasim Alatrash
Ā 
Git presentation
James Cuzella
Ā 
Source Code Management with Git
Things Lab
Ā 
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
Ā 
Git_new.pptx
BruceLee275640
Ā 
sample.pptx
UshaSuray
Ā 
390a gitintro 12au
Nguyen Van Hung
Ā 
Did you git yet?
Michael Fong
Ā 
Git 101 - An introduction to Version Control using Git
John Tighe
Ā 
Fundamentals and basics of Git and commands
DivyanshGupta922023
Ā 
Git and fundamentals
Naincy Gupta
Ā 
Collaborative development with Git | Workshop
Anuchit Chalothorn
Ā 
GIT Basics
Tagged Social
Ā 
Advanced Git Tutorial
Sage Sharp
Ā 
Git slides
Nanyak S
Ā 
Git workshop
Ray Toal
Ā 

Recently uploaded (20)

PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
Ā 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
Ā 
PDF
Continouous failure - Why do we make our lives hard?
Papp KrisztiƔn
Ā 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
Ā 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
Ā 
PDF
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
Ā 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
Ā 
PDF
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
Ā 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
Ā 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
Ā 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
Ā 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
Ā 
PDF
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
Ā 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
Ā 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
Ā 
PPTX
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
Ā 
PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
Ā 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
Ā 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
Ā 
PPTX
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
Ā 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
Ā 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
Ā 
Continouous failure - Why do we make our lives hard?
Papp KrisztiƔn
Ā 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
Ā 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
Ā 
Efficient, Automated Claims Processing Software for Insurers
Insurance Tech Services
Ā 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
Ā 
Thread In Android-Mastering Concurrency for Responsive Apps.pdf
Nabin Dhakal
Ā 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
Ā 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
Ā 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
Ā 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
Ā 
Powering GIS with FME and VertiGIS - Peak of Data & AI 2025
Safe Software
Ā 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
Ā 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
Ā 
Comprehensive Guide: Shoviv Exchange to Office 365 Migration Tool 2025
Shoviv Software
Ā 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
Ā 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
Ā 
Tally software_Introduction_Presentation
AditiBansal54083
Ā 
Equipment Management Software BIS Safety UK.pptx
BIS Safety Software
Ā 
Ad

Distributed Version control using Git and Github

  • 1. Workflow an opinionated discussion Grad Student, MIMS’14 Shreyas seekshreyas some slides adopted from and inspired by Scott Schacon’s https://github.com/schacon/git-presentations
  • 5. Problems • multiple versions • many contributors • ... conflicts
  • 6. git + Github a better workflow
  • 7. git git is an open source, distributed version control system designed for speed and efficiency
  • 8. git git is an open source, distributed version control system designed for speed and efficiency
  • 9. git git is an open source, distributed version control system designed for speed and efficiency
  • 10. git git is an open source, distributed version control system designed for speed and efficiency (almost) everything is local
  • 11. No Network needed for (almost) everything is local • Performing a diff • Viewing file history • Committing changes • Merging branches • Obtaining any other revision of a file • Switching branches
  • 12. git git is an open source, distributed version control system designed for speed and efficiency http://bit.ly/git-linus-intro ttp://bit.ly/git-advantages More Advantages
  • 13. .. and • No .svn directories • Independence
  • 15. getting setup ... $ git config --global user.name ā€œ<YOUR_NAME>ā€ $ git config --global user.email ā€œ<YOUR_EMAIL>ā€ or edit them in ~/.gitconfig
  • 16. lets dive in.. gitref.org/ • Creating New Repo • Committing • Branching/Merging • InspectionCloning a RepoUpdating
  • 17. lets dive in.. • Creating New Repo • Committing • Branching/Merging • Inspection • Cloning a Repo • Updating http://git-scm.com/docs
  • 18. Git Commands $ git init $ ls -al $ git init $ ls -al $ mkdir workspace $ cd workspace Initialized empty Git repository in ../workspace/.git/ drwxr-xr-x 10 Shreyas staff 340 Jan 15 17:22 .git • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating
  • 19. Git Commands • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating $ cd .git $ tree -a
  • 20. Git Commands $ git status • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating $ cd .. $ touch testfile.md branch name staging area
  • 21. Git Commands $ git add <filename> • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating staging area $ git status
  • 22. Git Commands $ git commit • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating your commit msg $ git status
  • 23. Git Commands $ git reset • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating (undo add) changes staged changes unstaged
  • 24. Git Commands $ git reset --soft HEAD^ • Creating New Repo • Committing • Branching/ Merging • Updating • Inspection • Cloning A Repo (undo a commit and redo) $ git reset --hard HEAD~3 Rewind the branch to get rid of last three commits http://git-scm.com/docs/git-r eset http://git-scm.com/docs/git-rev ert.html learn more here : also refer git revert : http://git-scm.com/docs/git-sta sh git stash :
  • 25. Git Commands $ git rm <filename> • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating remove a file from the repo as expected, you will need to commit the change $ git mv <filename> move/rename a file from the repo as expected, you will need to commit the change
  • 26. Git Commands $ git branch • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating list of branches $ git branch <branchname> new branch $ git checkout <branchname> switch
  • 27. Git Commands • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating new branch dev switch branch branch list
  • 28. Git Commands • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating $ git merge <branchname> merge branches branch merge
  • 29. Git Commands • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating $ git log --graph --decorate --abbrev-commit --all --pretty=oneline text-based graph :)
  • 30. Git Commands • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating ~/.gitconfig [alias] l = log --pretty=oneline -n 20 -- graph
  • 31. Git Commands • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating $ gitk
  • 32. Working with others... • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating github
  • 33. GitHub • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating create an account www.github.com/edu
  • 34. GitHub • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating add ssh key www.github.com/edu
  • 35. GitHub • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating $ git clone <url> <name> https://github.com/jblomo/ datamining290
  • 36. GitHub • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating Fork a repo
  • 37. GitHub • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating $ git pull $ git push = git fetch + git merge
  • 38. GitHub • Creating New Repo • Committing • Branching/ Merging • Inspection • Cloning a Repo • Updating GitHub Pull Request
  • 39. GitHub Ninja Features Markdown for documentation Pages for project hosting Gist for project hosting Service Hooks ā€˜do something’ on commit
  • 40. may the Force be with you

Editor's Notes

  • #2: we start off a project having a fair idea of what we are going to do ...
  • #3: soon we have multiple iterations, multiple versions...
  • #4: and then we have to collaborate, share...
  • #11: (almost) everything is local... branching, merging etc
  • #12: (almost) everything is local... branching, merging etc
  • #13: initially created by Linus Torvalds, now supported by a huge open source community ... field tested with Linux Kernel
  • #14: You don’t have to go ask someone to create a branch for you, or create a repo for you or request a branch merge.. you do as you please with YOUR copy.
  • #15: We’ll be using the git command line interface, but feel free to choose your preferred solution GUIs, Editor Extension etc
  • #23: Although, I like working in small steps, here are some shortcuts git commit -m ā€œ<your msg>ā€ [doesn’t open up the editor for msg] git commit -am ā€œ<your msg>ā€ [adds the files tracked and uses msg on command-line]
  • #36: now do a demo of jim workflow
  • #37: now show them a demo of creating ssh key on my ischool account
  • #39: show the students
  • #40: show the students