SlideShare a Scribd company logo
1 of 30
A Simple Introduction to Git: a
distributed version-control system
CS 5010 Program Design Paradigms
“Bootcamp”
Lesson 0.5
© Mitchell Wand, 2012-2014
This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1
Learning Objectives
• At the end of this lesson you should be able
to explain:
– how git creates a mini-filesystem in your directory
– what commit, push, pull, and sync do
– the elements of the basic git workflow
– how git allows you to work across multiple
computers
– how git allows you and a partner to work together
2
Git is a distributed version-control
system
• You keep your files in a repository on your local
machine.
• You synchronize your repository with a repository
on a server.
• If you move from one machine to another, you
can pick up the changes by synchronizing with
the server.
• If your partner uploads some changes to your
files, you can pick those up by synchronizing with
the server.
3
Git is a distributed version-control
system
• Terminology: In git-speak, a “version” is called
a “commit.”
• Git keeps track of the history of your commits,
so you can go back and look at earlier
versions, or just give up on the current version
and go back some earlier version.
4
A simple model of git
• Most git documentation gets into details very
quickly.
• Here’s a very simple model of what’s going on
in git.
5
Your files
my-project docs manual.docx
user_docs.docx
src
main.rkt
module1.rkt
module2.rkt
module3.rkt
Here are your files, sitting
in a directory called my-
project
6
Your files in your git repository
my-project docs manual.docx
user_docs.docx
src
main.rkt
module1.rkt
module2.rkt
module3.rkt
.git
When you have a git repository, you have
an additional directory called .git, which
points at a mini-filesystem.
This file system keeps all your data, plus the
bells and whistles that git needs to do its
job.
All this sits on your local machine.
7
The git client
.git
This mini-filesystem is highly optimized and
very complicated. Don’t try to read it
directly.
The job of the git client (either Github for
Windows, Github for Mac, or a suite of
command-line utilities) is to manage this for
you.
8
Your workflow (part 1)
• You edit your local files directly.
– You can edit, add files, delete files, etc., using
whatever tools you like.
– This doesn’t change the mini-filesystem, so now
your mini-fs is behind.
9
A Commit
.git
commit
When you do a “commit”, you
record all your local changes into
the mini-fs.
The mini-fs is “append-only”.
Nothing is ever over-written
there, so everything you ever
commit can be recovered.
10
Synchronizing with the server (1)
.git push
At the end of each work session, you need
to save your changes on the server. This is
called a “push”.
Now all your data is backed up.
• You can retrieve it, on your machine or
some other machine.
• We can retrieve it (that’s how we collect
homework)
your local machine
a server, somewhere on the
internet, eg. github.com
11
Synchronizing with the server (2)
.git pull
To retrieve your data from the server, you
do a “pull”. A “pull” takes the data from the
server and puts it both in your local mini-fs
and in your ordinary files.
If your local file has changed, git will merge
the changes if possible. If it can’t figure out
how to the merge, you will get an error
message. We'll learn how to deal with
these in the next lesson.
your local machine
a server, somewhere on the
internet, eg. github.com
pull
12
The whole picture
.git
pull
your local machine
a server, somewhere on the
internet, eg. github.ccs.neu.edu
pull
commit
push
13
The whole picture using GHFW
.git
your local machine
a server, somewhere on the
internet, eg. github.ccs.neu.edu
sync
commit
In Gihub For Windows or Github For Mac,
“push” and “pull” are combined into a
single operation called “sync”. So in these
clients, there are only two steps (“commit”
and “sync”) to worry about, not three.
sync
14
Your workflow (2)
sync
edit
commit
edit
commit
edit
commit
sync
Best practice: commit your
work whenever you’ve
gotten one part of your
problem working, or before
trying something that might
fail.
If your new stuff is screwed
up, you can always “revert”
to your last good commit.
(Remember: always
“revert”, never “roll back”)
15
Using Github for Windows/Mac
16
Your workflow with a partner
sync
edit
commit
edit
commit
edit
commit
sync
sync
edit
commit
edit
commit
edit
commit
sync
sync
edit
commit
edit
commit
edit
commit
sync
You You
Your Partner (or
you on another
computer)
Your partner
gets your work
from the server
You get your
partner’s work
from the server
server server
17
The new github desktop
• In the next few slides, we’ll give you the
updates for 2015.
• We won’t be using github.com. Instead we
will be using “Github for Enterprise” at
https://github.ccs.neu.edu
• The user interface for GHFW/GHFM has
changed. It’s now called “Github Desktop”.
• In the next few slides, we’ll show you how
your daily workflow looks with new interface.
18
Starting your work session
• Here’s what your Github Desktop should look like when you
open it up. Observe that your repos will be in the section
labeled “Enterprise”.
19
Where am I?
• The open blue circle indicates that you are looking at the most
recent local files
20
Always start by syncing
• This will download any changes that you or your partner have
made on other machines
21
Click on a dot to see a commit
• Clicking on the last dot will show you what was in your last
commit
• The dot turns blue
22
• In this view, you can see the first 6 characters of the unique
identifier (“the SHA”) for this commit
• You’ll need it for your Worksession Report
This shows your commit SHA
23
Now let’s work on our file
• Now the screen shows an uncommitted change.
24
• We write a commit message. Then we’ll click on “Commit to
Master”
Next, we commit our work
25
• Now it says “No uncommitted changes” again.
• You can also undo the commit if you want.
Here’s what you’ll see after a commit
26
• Click on the open circle to see what was in your commit, and
to record the commit SHA. Here’s that screen again:
Be sure to record the commit SHA
27
• Your work is not saved on the server until you sync.
Be sure to sync!!!
28
Submit a Work Session Report
• At the end of your work
session, submit a work
session report via the web.
• The URL for the work
session report will appear in
each problem set.
• The report will ask for the
SHA of your last commit.
You can get this from the
Github Desktop, as we’ve
shown you.
29
Summary
• In this lesson you have learned
– that git creates a mini-filesystem in your directory
– what commit, push, pull, and sync do
– the elements of the basic git workflow
– how git allows you to work across multiple
computers
– how git allows you and a partner to work together
30

More Related Content

Similar to Lesson 0.5 Introduction to Git (1).pptx

BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersMartin Jinoch
 
Git for developers
Git for developersGit for developers
Git for developersHacen Dadda
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git聖文 鄭
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshellalignan
 
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git John Tighe
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)Yeasin Abedin
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfGDSCKNUST
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testersupadhyay_25
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfmurad khan
 

Similar to Lesson 0.5 Introduction to Git (1).pptx (20)

BLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes DevelopersBLUG 2012 Version Control for Notes Developers
BLUG 2012 Version Control for Notes Developers
 
Git for developers
Git for developersGit for developers
Git for developers
 
Gn unify git
Gn unify gitGn unify git
Gn unify git
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Brief tutorial on Git
Brief tutorial on GitBrief tutorial on Git
Brief tutorial on Git
 
Git
GitGit
Git
 
GIT in a nutshell
GIT in a nutshellGIT in a nutshell
GIT in a nutshell
 
Git
GitGit
Git
 
Git github
Git githubGit github
Git github
 
Switching to Git
Switching to GitSwitching to Git
Switching to Git
 
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git
 
Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
wdt_09.pptx
wdt_09.pptxwdt_09.pptx
wdt_09.pptx
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdf
 
Git - Simplified For Testers
Git - Simplified For TestersGit - Simplified For Testers
Git - Simplified For Testers
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdf
 

Recently uploaded

Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607dollysharma2066
 
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our EscortsCall Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escortsindian call girls near you
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girladitipandeya
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Roomdivyansh0kumar0
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneCall girls in Ahmedabad High profile
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of indiaimessage0108
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Roomgirls4nights
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITMgdsc13
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 

Recently uploaded (20)

Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in  Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Jamuna Vihar Delhi reach out to us at 🔝9953056974🔝
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
FULL ENJOY Call Girls In Mayur Vihar Delhi Contact Us 8377087607
 
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 26 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our EscortsCall Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
Call Girls in East Of Kailash 9711199171 Delhi Enjoy Call Girls With Our Escorts
 
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call GirlVIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
VIP 7001035870 Find & Meet Hyderabad Call Girls LB Nagar high-profile Call Girl
 
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130  Available With RoomVIP Kolkata Call Girl Alambazar 👉 8250192130  Available With Room
VIP Kolkata Call Girl Alambazar 👉 8250192130 Available With Room
 
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service ThaneRussian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
Russian Call Girls Thane Swara 8617697112 Independent Escort Service Thane
 
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 22 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No AdvanceRohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
Rohini Sector 6 Call Girls Delhi 9999965857 @Sabina Saikh No Advance
 
Gram Darshan PPT cyber rural in villages of india
Gram Darshan PPT cyber rural  in villages of indiaGram Darshan PPT cyber rural  in villages of india
Gram Darshan PPT cyber rural in villages of india
 
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls KolkataVIP Call Girls Kolkata Ananya 🤌  8250192130 🚀 Vip Call Girls Kolkata
VIP Call Girls Kolkata Ananya 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With RoomVIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
VIP Kolkata Call Girls Salt Lake 8250192130 Available With Room
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Ishita 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Ishita 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls KolkataLow Rate Call Girls Kolkata Avani 🤌  8250192130 🚀 Vip Call Girls Kolkata
Low Rate Call Girls Kolkata Avani 🤌 8250192130 🚀 Vip Call Girls Kolkata
 

Lesson 0.5 Introduction to Git (1).pptx

  • 1. A Simple Introduction to Git: a distributed version-control system CS 5010 Program Design Paradigms “Bootcamp” Lesson 0.5 © Mitchell Wand, 2012-2014 This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License. 1
  • 2. Learning Objectives • At the end of this lesson you should be able to explain: – how git creates a mini-filesystem in your directory – what commit, push, pull, and sync do – the elements of the basic git workflow – how git allows you to work across multiple computers – how git allows you and a partner to work together 2
  • 3. Git is a distributed version-control system • You keep your files in a repository on your local machine. • You synchronize your repository with a repository on a server. • If you move from one machine to another, you can pick up the changes by synchronizing with the server. • If your partner uploads some changes to your files, you can pick those up by synchronizing with the server. 3
  • 4. Git is a distributed version-control system • Terminology: In git-speak, a “version” is called a “commit.” • Git keeps track of the history of your commits, so you can go back and look at earlier versions, or just give up on the current version and go back some earlier version. 4
  • 5. A simple model of git • Most git documentation gets into details very quickly. • Here’s a very simple model of what’s going on in git. 5
  • 6. Your files my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt Here are your files, sitting in a directory called my- project 6
  • 7. Your files in your git repository my-project docs manual.docx user_docs.docx src main.rkt module1.rkt module2.rkt module3.rkt .git When you have a git repository, you have an additional directory called .git, which points at a mini-filesystem. This file system keeps all your data, plus the bells and whistles that git needs to do its job. All this sits on your local machine. 7
  • 8. The git client .git This mini-filesystem is highly optimized and very complicated. Don’t try to read it directly. The job of the git client (either Github for Windows, Github for Mac, or a suite of command-line utilities) is to manage this for you. 8
  • 9. Your workflow (part 1) • You edit your local files directly. – You can edit, add files, delete files, etc., using whatever tools you like. – This doesn’t change the mini-filesystem, so now your mini-fs is behind. 9
  • 10. A Commit .git commit When you do a “commit”, you record all your local changes into the mini-fs. The mini-fs is “append-only”. Nothing is ever over-written there, so everything you ever commit can be recovered. 10
  • 11. Synchronizing with the server (1) .git push At the end of each work session, you need to save your changes on the server. This is called a “push”. Now all your data is backed up. • You can retrieve it, on your machine or some other machine. • We can retrieve it (that’s how we collect homework) your local machine a server, somewhere on the internet, eg. github.com 11
  • 12. Synchronizing with the server (2) .git pull To retrieve your data from the server, you do a “pull”. A “pull” takes the data from the server and puts it both in your local mini-fs and in your ordinary files. If your local file has changed, git will merge the changes if possible. If it can’t figure out how to the merge, you will get an error message. We'll learn how to deal with these in the next lesson. your local machine a server, somewhere on the internet, eg. github.com pull 12
  • 13. The whole picture .git pull your local machine a server, somewhere on the internet, eg. github.ccs.neu.edu pull commit push 13
  • 14. The whole picture using GHFW .git your local machine a server, somewhere on the internet, eg. github.ccs.neu.edu sync commit In Gihub For Windows or Github For Mac, “push” and “pull” are combined into a single operation called “sync”. So in these clients, there are only two steps (“commit” and “sync”) to worry about, not three. sync 14
  • 15. Your workflow (2) sync edit commit edit commit edit commit sync Best practice: commit your work whenever you’ve gotten one part of your problem working, or before trying something that might fail. If your new stuff is screwed up, you can always “revert” to your last good commit. (Remember: always “revert”, never “roll back”) 15
  • 16. Using Github for Windows/Mac 16
  • 17. Your workflow with a partner sync edit commit edit commit edit commit sync sync edit commit edit commit edit commit sync sync edit commit edit commit edit commit sync You You Your Partner (or you on another computer) Your partner gets your work from the server You get your partner’s work from the server server server 17
  • 18. The new github desktop • In the next few slides, we’ll give you the updates for 2015. • We won’t be using github.com. Instead we will be using “Github for Enterprise” at https://github.ccs.neu.edu • The user interface for GHFW/GHFM has changed. It’s now called “Github Desktop”. • In the next few slides, we’ll show you how your daily workflow looks with new interface. 18
  • 19. Starting your work session • Here’s what your Github Desktop should look like when you open it up. Observe that your repos will be in the section labeled “Enterprise”. 19
  • 20. Where am I? • The open blue circle indicates that you are looking at the most recent local files 20
  • 21. Always start by syncing • This will download any changes that you or your partner have made on other machines 21
  • 22. Click on a dot to see a commit • Clicking on the last dot will show you what was in your last commit • The dot turns blue 22
  • 23. • In this view, you can see the first 6 characters of the unique identifier (“the SHA”) for this commit • You’ll need it for your Worksession Report This shows your commit SHA 23
  • 24. Now let’s work on our file • Now the screen shows an uncommitted change. 24
  • 25. • We write a commit message. Then we’ll click on “Commit to Master” Next, we commit our work 25
  • 26. • Now it says “No uncommitted changes” again. • You can also undo the commit if you want. Here’s what you’ll see after a commit 26
  • 27. • Click on the open circle to see what was in your commit, and to record the commit SHA. Here’s that screen again: Be sure to record the commit SHA 27
  • 28. • Your work is not saved on the server until you sync. Be sure to sync!!! 28
  • 29. Submit a Work Session Report • At the end of your work session, submit a work session report via the web. • The URL for the work session report will appear in each problem set. • The report will ask for the SHA of your last commit. You can get this from the Github Desktop, as we’ve shown you. 29
  • 30. Summary • In this lesson you have learned – that git creates a mini-filesystem in your directory – what commit, push, pull, and sync do – the elements of the basic git workflow – how git allows you to work across multiple computers – how git allows you and a partner to work together 30