SlideShare a Scribd company logo
1 of 20
GIT Training
Arashdeep Kaur
Why is Git Around?
 Consider we are working on some project, there are fi, f2, f3 files in one folder and
we want them to save them after changes. This will fill our hard disk if we want to
keep each version of file.
Project.zip Projectfinal.zip Projectfinal1.zip Projectfinal2.zip
Version Control System(VCS)
 a way to manage files and directories.
 track changes over time.
 recall previous versions.
 source control is subset of VCS.
 sharing on multiple computers
Local VCS
Centralized VCS
 Subversion (SVN)
• checkout
• update
• commit
Distributed VCS
 GIT
 Mercurial
GIT
 Created by Linus Torvalds, creator of Linux, in 2005
– Came out of Linux development community
– Designed to do version control on Linux kernel
 Goals of Git:
- Speed
- Support for non-linear development (thousands of parallel branches)
- Fully distributed
- Able to handle large projects efficiently
Features of GIT
 Snapshots, NOT differences
 Nearly every operation is local.
 Git has Integrity(checksum)
Storing data as snapshots of the project over time
Git installation
Let’s Start with GIT
• Enter these lines (with appropriate changes):
git config --global user.name "John Smith“
git config --global user.email jsmith@seas.upenn.edu
The Three stage
architecture
 You modify files in your working
tree.
 You selectively stage just those
changes you want to be part of
your next commit, which
adds only those changes to the
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
Create and fill a repository
cd to the project directory you want to use
• This creates the repository (a directory named .git)
• You seldom (if ever) need to look inside this directory
Type in git init
• Period means “this directory”
• This adds all your current files to the repository
Type in git add .
• You can use a different commit message, if you like
Type in git commit –m "Initial commit"
Clone a repository from elsewhere
 git clone URL
 git clone
https://github.com/ishant
k/DSA2020-1
 Instead of getting just a
working copy, Git receives a
full copy of nearly all data that
the server has.
Lifecycle of status of files
Lifecycle of status of your files.
Working with your
own repository
 A head is a reference to a commit
object
 The “current head” is called HEAD
(all caps)
 This results in a linear graph:
A  B  C  … HEAD
Back tracking, Removing, Rename
 Rolling back to last commit
$ git checkout HEAD [filename]
$ git diff
 Skipping staging area
$ git commit –a –m “your message”
 Remove File from Staging
$ git reset HEAD [filename]
 Remove file in Git
$ git rm [filename]
 Rename file in Git
$ git mv [current_filename] [changed_filename]
Initial commit
Second commit
Third commit
Bob gets a copy
Fourth commit
Merge
Bob’s commit
Multiple versions
Branching
 View branch
 Make new branch
 Merge branch
 Delete Branch
Pushing git branches
GITHUB
 GitHub.com is a site for online storage of Git repositories.
– You can create a remote repo there and push code to it.
– Many open source projects use it, such as the Linux kernel.
– You can get free space for open source projects, or you can pay for private projects.
 Question: Do I always have to use GitHub to use Git?
 Answer: No! You can use Git locally for your own purposes. – Or you or someone
else could set up a server to share files. – Or you could share a repo with users on
the same file system, as long everyone has the needed file permissions).

More Related Content

What's hot

Git_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGit_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGandhi Ramu
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
Git the fast version control system
Git the fast version control systemGit the fast version control system
Git the fast version control systemJeroen Rosenberg
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewRueful Robin
 
How to store large binary files in git repositories
How to store large binary files in git repositoriesHow to store large binary files in git repositories
How to store large binary files in git repositoriesMatt Aunger
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitColin Su
 
Terrible Ideas in Git - Corey Quinn, FutureAdvisor - DevOpsDays Tel Aviv 2015
Terrible Ideas in Git - Corey Quinn, FutureAdvisor - DevOpsDays Tel Aviv 2015Terrible Ideas in Git - Corey Quinn, FutureAdvisor - DevOpsDays Tel Aviv 2015
Terrible Ideas in Git - Corey Quinn, FutureAdvisor - DevOpsDays Tel Aviv 2015DevOpsDays Tel Aviv
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using GitYan Vugenfirer
 
Git ritesh venture_pact
Git ritesh venture_pactGit ritesh venture_pact
Git ritesh venture_pactriteshtandon23
 
Tài liệu sử dụng GitHub
Tài liệu sử dụng GitHubTài liệu sử dụng GitHub
Tài liệu sử dụng GitHubviet nghiem
 
Git and fundamentals
Git and fundamentalsGit and fundamentals
Git and fundamentalsNaincy Gupta
 
Version control system
Version control systemVersion control system
Version control systemAndrew Liu
 

What's hot (20)

Git_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_GuidewireGit_and_GitHub Integration_with_Guidewire
Git_and_GitHub Integration_with_Guidewire
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
Git the fast version control system
Git the fast version control systemGit the fast version control system
Git the fast version control system
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overviewGit and GitHub | Concept about Git and GitHub Process | Git Process overview
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
 
How to store large binary files in git repositories
How to store large binary files in git repositoriesHow to store large binary files in git repositories
How to store large binary files in git repositories
 
Git Presentation
Git PresentationGit Presentation
Git Presentation
 
Git theory
Git   theoryGit   theory
Git theory
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Git basics
Git basicsGit basics
Git basics
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Terrible Ideas in Git - Corey Quinn, FutureAdvisor - DevOpsDays Tel Aviv 2015
Terrible Ideas in Git - Corey Quinn, FutureAdvisor - DevOpsDays Tel Aviv 2015Terrible Ideas in Git - Corey Quinn, FutureAdvisor - DevOpsDays Tel Aviv 2015
Terrible Ideas in Git - Corey Quinn, FutureAdvisor - DevOpsDays Tel Aviv 2015
 
Github
GithubGithub
Github
 
Contributing to open source using Git
Contributing to open source using GitContributing to open source using Git
Contributing to open source using Git
 
Git ritesh venture_pact
Git ritesh venture_pactGit ritesh venture_pact
Git ritesh venture_pact
 
Tài liệu sử dụng GitHub
Tài liệu sử dụng GitHubTài liệu sử dụng GitHub
Tài liệu sử dụng GitHub
 
Git and fundamentals
Git and fundamentalsGit and fundamentals
Git and fundamentals
 
Version control system
Version control systemVersion control system
Version control system
 
Git & git hub
Git & git hubGit & git hub
Git & git hub
 
Git slides
Git slidesGit slides
Git slides
 

Similar to Git training (basic)

Similar to Git training (basic) (20)

Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
CSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GITCSE 390 Lecture 9 - Version Control with GIT
CSE 390 Lecture 9 - Version Control with GIT
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git and github
Git and githubGit and github
Git and github
 
GIT.pptx
GIT.pptxGIT.pptx
GIT.pptx
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git and Github
Git and GithubGit and Github
Git and Github
 
Git 101
Git 101Git 101
Git 101
 
git.ppt.pdf
git.ppt.pdfgit.ppt.pdf
git.ppt.pdf
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
Introduction to git & GitHub
Introduction to git & GitHubIntroduction to git & GitHub
Introduction to git & GitHub
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 
Learning git
Learning gitLearning git
Learning git
 
setting up a repository using GIT
setting up a repository using GITsetting up a repository using GIT
setting up a repository using GIT
 
Git is a distributed version control system .
Git is a distributed version control system .Git is a distributed version control system .
Git is a distributed version control system .
 
GIT-FirstPart.ppt
GIT-FirstPart.pptGIT-FirstPart.ppt
GIT-FirstPart.ppt
 
Subversion to Git Migration
Subversion to Git MigrationSubversion to Git Migration
Subversion to Git Migration
 
Git hub
Git hubGit hub
Git hub
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Git training (basic)

  • 2. Why is Git Around?  Consider we are working on some project, there are fi, f2, f3 files in one folder and we want them to save them after changes. This will fill our hard disk if we want to keep each version of file. Project.zip Projectfinal.zip Projectfinal1.zip Projectfinal2.zip
  • 3. Version Control System(VCS)  a way to manage files and directories.  track changes over time.  recall previous versions.  source control is subset of VCS.  sharing on multiple computers
  • 5. Centralized VCS  Subversion (SVN) • checkout • update • commit
  • 7. GIT  Created by Linus Torvalds, creator of Linux, in 2005 – Came out of Linux development community – Designed to do version control on Linux kernel  Goals of Git: - Speed - Support for non-linear development (thousands of parallel branches) - Fully distributed - Able to handle large projects efficiently
  • 8. Features of GIT  Snapshots, NOT differences  Nearly every operation is local.  Git has Integrity(checksum) Storing data as snapshots of the project over time
  • 10. Let’s Start with GIT • Enter these lines (with appropriate changes): git config --global user.name "John Smith“ git config --global user.email jsmith@seas.upenn.edu
  • 11. The Three stage architecture  You modify files in your working tree.  You selectively stage just those changes you want to be part of your next commit, which adds only those changes to the 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
  • 12. Create and fill a repository cd to the project directory you want to use • This creates the repository (a directory named .git) • You seldom (if ever) need to look inside this directory Type in git init • Period means “this directory” • This adds all your current files to the repository Type in git add . • You can use a different commit message, if you like Type in git commit –m "Initial commit"
  • 13. Clone a repository from elsewhere  git clone URL  git clone https://github.com/ishant k/DSA2020-1  Instead of getting just a working copy, Git receives a full copy of nearly all data that the server has.
  • 14. Lifecycle of status of files Lifecycle of status of your files.
  • 15. Working with your own repository  A head is a reference to a commit object  The “current head” is called HEAD (all caps)  This results in a linear graph: A  B  C  … HEAD
  • 16. Back tracking, Removing, Rename  Rolling back to last commit $ git checkout HEAD [filename] $ git diff  Skipping staging area $ git commit –a –m “your message”  Remove File from Staging $ git reset HEAD [filename]  Remove file in Git $ git rm [filename]  Rename file in Git $ git mv [current_filename] [changed_filename]
  • 17. Initial commit Second commit Third commit Bob gets a copy Fourth commit Merge Bob’s commit Multiple versions
  • 18. Branching  View branch  Make new branch  Merge branch  Delete Branch
  • 20. GITHUB  GitHub.com is a site for online storage of Git repositories. – You can create a remote repo there and push code to it. – Many open source projects use it, such as the Linux kernel. – You can get free space for open source projects, or you can pay for private projects.  Question: Do I always have to use GitHub to use Git?  Answer: No! You can use Git locally for your own purposes. – Or you or someone else could set up a server to share files. – Or you could share a repo with users on the same file system, as long everyone has the needed file permissions).