SlideShare a Scribd company logo
Source control
Content
 Version control
 Advantages & disadvantages of GIT
 GIT basics
2
Version Control
 Version control (or revision control, or source control) is all
about managing multiple versions of documents,
programs, web sites, etc.
 Some well-known version control systems are CVS, Subversion,
Mercurial, and Git.
 Distributed systems like Mercurial and Git are newer and are
gradually replacing centralized systems like
CVS and Subversion.
3
Local Version Control
 Local version-control method of choice is to copy files into
another directory(perhaps a time-stamped directory, if they’re
clever).
 This approach is very common because it is so simple, but
it is also incredibly error prone.
 Ex :-
• RCS
4
Local Version Control5
Centralized Version Control
 Traditional version control system.
• Server with database
• Clients have a working version
 Challenges
• Multi-developer conflicts
• Client/server communication
 Ex :-
• CVS
• Subversion
• Visual source safe
6
Centralized Version Control
7
Distributed Version Control
 Authoritative server by convention only.
 Every working checkout is a repository.
 Get version control even when detached.
 Backups are trivial.
 Ex :-
• Mercurial
• BitKeeper
• Darcs
• Bazaar
8
Distributed Version Control
9
Advantages of GIT
 Resilience
• No one repository has more data than any other
 Speed
• Very fast operations compared to other VCS (I’m looking at
you CVS and Subversion)
 Space
• Compression can be done across repository not just per file
• Minimizes local size as well as push/pull data transfers
 Simplicity
• Object model is very simple
 Large user base with robust tools
10
Disadvantages of GIT
 Definite learning curve, especially for those used to centralized
systems.
• Can sometimes seem overwhelming to learn
 Conceptual difference
 Huge amount of commends
11
GIT Basics
 Storing data as changes to a base version of
each file.
12
 Storing data as snapshots of the project over time.
13
 Working directory, staging area, and Git directory.
14
Introduce yourself to GIT
 Enter these lines (with appropriate changes):
• git config --global user.name "John Smith"
• git config --global user.email
jsmith@seas.upenn.edu
 You only need to do this once.
 If you want to use a different name/email address for a particular
project, you can change it for just that project.
• cd to the project directory.
• Use the above commands, but leave out the --global
15
Create and fill a repository
 cd to the project directory you want to use.
 Type in git init
• This creates the repository (a directory named .git).
• You seldom (if ever) need to look inside this directory.
 Type in git add
• The period at the end is part of this command!
• Period means “this directory”.
• This adds all your current files to the repository.
 Type in git commit –m "Initial commit“
• You can use a different commit message, if you like.
16
Clone a repository from elsewhere
 git clone URL
 git clone URL mypath
• These make an exact copy of the repository at the given URL.
 git clone git://github.com/rest_of_path/file.git
• Github is the most popular (free) public repository.
 All repositories are equal,
• But you can treat some particular repository (such as one on
Github) as the “master” directory.
 Typically, each team member works in his/her own repository,
and “merges” with other repositories as appropriate.
17
Making commits
 If you create new files and/or folders, they are not tracked by Git
unless you ask it to do so.
• git add newFile1 newFolder1 newFolder2 newFile2
 Committing makes a “snapshot” of everything being tracked into
your repository.
• A message telling what you have done is required
• git commit –m “Uncrevulated the conundrum bar”
• git commit
 This version opens an editor for you the enter the message.
 To finish, save and quit the editor.
 Format of the commit message.
• One line containing the complete summary.
• If more than one line, the second line must be blank.
18
Choose an editor
When you “commit,” git will require you to type in a commit
message.
For longer commit messages, you will use an editor.
The default editor is probably vim .
To change the default editor:
• git config --global core.editor /path/to/editor
You may also want to turn on colors:
• git config --global color.ui auto
19
Typical workflow
 git pull remote_repository
• Get changes from a remote repository and merge them into
your own repository.
 git status
• See what Git thinks is going on.
• Use this frequently!
 Work on your files (remember to add any new ones).
 git commit –m “What I did”
 git push
20
Multiple versions
Initial commit
Second commit
Third commit
Bob gets a copy
Fourth commit
Merge
Bob’s commit
21
Source control
Ad

More Related Content

What's hot (20)

Git advanced
Git advancedGit advanced
Git advanced
Peter Vandenabeele
 
Git real slides
Git real slidesGit real slides
Git real slides
Lucas Couto
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
Gaurav Wable
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Somkiat Puisungnoen
 
GitHub Basics - Derek Bable
GitHub Basics - Derek BableGitHub Basics - Derek Bable
GitHub Basics - Derek Bable
"FENG "GEORGE"" YU
 
Git Introduction Tutorial
Git Introduction TutorialGit Introduction Tutorial
Git Introduction Tutorial
Thomas Rausch
 
The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
E Carter
 
Git
GitGit
Git
Gayan Kalanamith Mannapperuma
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola
 
Github - Git Training Slides: Foundations
Github - Git Training Slides: FoundationsGithub - Git Training Slides: Foundations
Github - Git Training Slides: Foundations
Lee Hanxue
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
Roland Emmanuel Salunga
 
Git for beginners
Git for beginnersGit for beginners
Git for beginners
Arulmurugan Rajaraman
 
Github basics
Github basicsGithub basics
Github basics
Radoslav Georgiev
 
Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
Introduction to Git Commands and Concepts
Introduction to Git Commands and ConceptsIntroduction to Git Commands and Concepts
Introduction to Git Commands and Concepts
Carl Brown
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
Sergiu-Ioan Ungur
 
Learning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdfLearning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdf
Jayprakash677449
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
 

Similar to Source control (20)

Source control
Source controlSource control
Source control
anushka perera
 
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, TrivandrumIntroduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
Introduction to Git and Github - Google Developer Student Clubs CET, Trivandrum
AbhijitNarayan2
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
Bimal Jain
 
git.ppt
git.pptgit.ppt
git.ppt
ssuser10dcd71
 
Git training (basic)
Git training (basic)Git training (basic)
Git training (basic)
Arashdeepkaur16
 
Git
GitGit
Git
zafarfaizi
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Nguyen Van Hung
 
Git
GitGit
Git
Alf Chang
 
Basics of git
Basics of gitBasics of git
Basics of git
Ahmed Al-sabsab
 
Git hub
Git hubGit hub
Git hub
Nitin Goel
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
ssusered2ec2
 
Git
GitGit
Git
Vijay Kani
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey
 
Git for developers
Git for developersGit for developers
Git for developers
Hacen Dadda
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
Soumen Debgupta
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
Max Claus Nunes
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
Sameera Wijesekara
 
Git Session 2K23.pptx
Git Session 2K23.pptxGit Session 2K23.pptx
Git Session 2K23.pptx
Eshaan35
 
Introduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptxIntroduction to git and githhub with practicals.pptx
Introduction to git and githhub with practicals.pptx
Abdul Salam
 
GIT_Overview.
GIT_Overview.GIT_Overview.
GIT_Overview.
Mithilesh Singh
 
Ad

More from Sachithra Gayan (6)

Computer Network Security
Computer Network SecurityComputer Network Security
Computer Network Security
Sachithra Gayan
 
Embedded Robotics
Embedded RoboticsEmbedded Robotics
Embedded Robotics
Sachithra Gayan
 
Best Practices in Project Management
Best Practices in Project ManagementBest Practices in Project Management
Best Practices in Project Management
Sachithra Gayan
 
Data acquisition softwares
Data acquisition softwaresData acquisition softwares
Data acquisition softwares
Sachithra Gayan
 
Software Quality Assurance
Software Quality AssuranceSoftware Quality Assurance
Software Quality Assurance
Sachithra Gayan
 
Test Driven Development
Test Driven DevelopmentTest Driven Development
Test Driven Development
Sachithra Gayan
 
Computer Network Security
Computer Network SecurityComputer Network Security
Computer Network Security
Sachithra Gayan
 
Best Practices in Project Management
Best Practices in Project ManagementBest Practices in Project Management
Best Practices in Project Management
Sachithra Gayan
 
Data acquisition softwares
Data acquisition softwaresData acquisition softwares
Data acquisition softwares
Sachithra Gayan
 
Software Quality Assurance
Software Quality AssuranceSoftware Quality Assurance
Software Quality Assurance
Sachithra Gayan
 
Ad

Recently uploaded (20)

Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)Who Watches the Watchmen (SciFiDevCon 2025)
Who Watches the Watchmen (SciFiDevCon 2025)
Allon Mureinik
 
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdfMicrosoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
Microsoft AI Nonprofit Use Cases and Live Demo_2025.04.30.pdf
TechSoup
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Exceptional Behaviors: How Frequently Are They Tested? (AST 2025)
Andre Hora
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
How can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptxHow can one start with crypto wallet development.pptx
How can one start with crypto wallet development.pptx
laravinson24
 
The Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdfThe Significance of Hardware in Information Systems.pdf
The Significance of Hardware in Information Systems.pdf
drewplanas10
 
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New VersionPixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
Pixologic ZBrush Crack Plus Activation Key [Latest 2025] New Version
saimabibi60507
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software DevelopmentSecure Test Infrastructure: The Backbone of Trustworthy Software Development
Secure Test Infrastructure: The Backbone of Trustworthy Software Development
Shubham Joshi
 
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
How to Batch Export Lotus Notes NSF Emails to Outlook PST Easily?
steaveroggers
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025PDF Reader Pro Crack Latest Version FREE Download 2025
PDF Reader Pro Crack Latest Version FREE Download 2025
mu394968
 
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025Why Orangescrum Is a Game Changer for Construction Companies in 2025
Why Orangescrum Is a Game Changer for Construction Companies in 2025
Orangescrum
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 

Source control

  • 2. Content  Version control  Advantages & disadvantages of GIT  GIT basics 2
  • 3. Version Control  Version control (or revision control, or source control) is all about managing multiple versions of documents, programs, web sites, etc.  Some well-known version control systems are CVS, Subversion, Mercurial, and Git.  Distributed systems like Mercurial and Git are newer and are gradually replacing centralized systems like CVS and Subversion. 3
  • 4. Local Version Control  Local version-control method of choice is to copy files into another directory(perhaps a time-stamped directory, if they’re clever).  This approach is very common because it is so simple, but it is also incredibly error prone.  Ex :- • RCS 4
  • 6. Centralized Version Control  Traditional version control system. • Server with database • Clients have a working version  Challenges • Multi-developer conflicts • Client/server communication  Ex :- • CVS • Subversion • Visual source safe 6
  • 8. Distributed Version Control  Authoritative server by convention only.  Every working checkout is a repository.  Get version control even when detached.  Backups are trivial.  Ex :- • Mercurial • BitKeeper • Darcs • Bazaar 8
  • 10. Advantages of GIT  Resilience • No one repository has more data than any other  Speed • Very fast operations compared to other VCS (I’m looking at you CVS and Subversion)  Space • Compression can be done across repository not just per file • Minimizes local size as well as push/pull data transfers  Simplicity • Object model is very simple  Large user base with robust tools 10
  • 11. Disadvantages of GIT  Definite learning curve, especially for those used to centralized systems. • Can sometimes seem overwhelming to learn  Conceptual difference  Huge amount of commends 11
  • 12. GIT Basics  Storing data as changes to a base version of each file. 12
  • 13.  Storing data as snapshots of the project over time. 13
  • 14.  Working directory, staging area, and Git directory. 14
  • 15. Introduce yourself to GIT  Enter these lines (with appropriate changes): • git config --global user.name "John Smith" • git config --global user.email [email protected]  You only need to do this once.  If you want to use a different name/email address for a particular project, you can change it for just that project. • cd to the project directory. • Use the above commands, but leave out the --global 15
  • 16. Create and fill a repository  cd to the project directory you want to use.  Type in git init • This creates the repository (a directory named .git). • You seldom (if ever) need to look inside this directory.  Type in git add • The period at the end is part of this command! • Period means “this directory”. • This adds all your current files to the repository.  Type in git commit –m "Initial commit“ • You can use a different commit message, if you like. 16
  • 17. Clone a repository from elsewhere  git clone URL  git clone URL mypath • These make an exact copy of the repository at the given URL.  git clone git://github.com/rest_of_path/file.git • Github is the most popular (free) public repository.  All repositories are equal, • But you can treat some particular repository (such as one on Github) as the “master” directory.  Typically, each team member works in his/her own repository, and “merges” with other repositories as appropriate. 17
  • 18. Making commits  If you create new files and/or folders, they are not tracked by Git unless you ask it to do so. • git add newFile1 newFolder1 newFolder2 newFile2  Committing makes a “snapshot” of everything being tracked into your repository. • A message telling what you have done is required • git commit –m “Uncrevulated the conundrum bar” • git commit  This version opens an editor for you the enter the message.  To finish, save and quit the editor.  Format of the commit message. • One line containing the complete summary. • If more than one line, the second line must be blank. 18
  • 19. Choose an editor When you “commit,” git will require you to type in a commit message. For longer commit messages, you will use an editor. The default editor is probably vim . To change the default editor: • git config --global core.editor /path/to/editor You may also want to turn on colors: • git config --global color.ui auto 19
  • 20. Typical workflow  git pull remote_repository • Get changes from a remote repository and merge them into your own repository.  git status • See what Git thinks is going on. • Use this frequently!  Work on your files (remember to add any new ones).  git commit –m “What I did”  git push 20
  • 21. Multiple versions Initial commit Second commit Third commit Bob gets a copy Fourth commit Merge Bob’s commit 21

Editor's Notes

  • #4: What is “version control”, and why should you care? Version control is a system that records changes to a file or set of files over time so that you can recall specific versions later.
  • #5: It is easy to forget which directory you’re in and accidentally write to the wrong file or copy over files you don’t mean to. To deal with this issue, programmers long ago developed local VCSs that had a simple database that kept all the changes to files under revision control.
  • #11: A distributed version control system
  • #13: The major difference between Git and any other VCS (Subversion and friends included) is the way Git thinks about its data. Conceptually, most other systems store information as a list of file-based changes. These systems (CVS, Subversion, Perforce, Bazaar, and so on) think of the information they keep as a set of files and the changes made to each file over time.
  • #14: Git doesn’t think of or store its data this way. Instead, Git thinks of its data more like a set of snapshots of a miniature filesystem. Every time you commit, or save the state of your project in Git, it basically takes a picture of what all your files look like at that moment and stores a reference to that snapshot. To be efficient, if files have not changed, Git doesn’t store the file again, just a link to the previous identical file it has already stored. Git thinks about its data more like a stream of snapshots.
  • #15: 1. You modify files in your working directory. 2. You stage the files, adding snapshots of them to your staging area. 3. You do a commit, which takes the files as they are in the staging area and stores that snapshot permanently to your Git directory.
  • #16: Git echo ‘my project’ > sac
  • #17: Your top-level working directory contains everything about your project The working directory probably contains many subdirectories—source code, binaries, documentation, data files, etc. One of these subdirectories, named .git, is your repository At any time, you can take a “snapshot” of everything (or selected things) in your project directory, and put it in your repository When you said git init in your project directory, or when you cloned an existing project, you created a repository The repository is a subdirectory named .git containing various files The dot indicates a “hidden” directory You do not work directly with the contents of that directory; various git commands do that for you You do need a basic understanding of what is in the repository
  • #19: A commit is when you tell git that a change (or addition) you have made is ready to be included in the project