SlideShare ist ein Scribd-Unternehmen logo
1 von 32
Downloaden Sie, um offline zu lesen
- Behzad Altaf
A 2-3-5-7-11-13…-r
Agenda
• Version Control
• What
• Why
• Types
• How
• Git
• History
• Fundamentals
• Basic Commands
• Branching
• Working with remote
• Further reading/ references
• Tips
Version Control
• In computer software engineering, revision control is any kind of practice
that tracks and provides control over changes to source code.
• 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.
https://en.wikipedia.org/wiki/Version_control
Version Control – Why?
Version Control – Why?
http://www.webdesignerdepot.com/2009/03/intro-to-git-for-web-designers/
Version Control – Why?
Version Control - Local
https://git-scm.com/book/en/v2
Version Control - Centralized
https://git-scm.com/book/en/v2
Version Control - Distributed
https://git-scm.com/book/en/v2
Version Control - options
What is git?
Distributed Performant Reliable
Git – History
• The Linux kernel is an open source software project of fairly large scope. For most of the lifetime of the
Linux kernel maintenance (1991–2002), changes to the software were passed around as patches and
archived files. In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper.
• In 2005, the relationship between the community that developed the Linux kernel and the commercial
company that developed BitKeeper broke down, and the tool’s free-of-charge status was revoked. This
prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to
develop their own tool based on some of the lessons they learned while using BitKeeper.
https://git-scm.com/book/en/v2
Git - Data Storage
Storing data as changes to a base version of each file.
Storing data as snapshots of the project over time.
https://git-scm.com/book/en/v2
Git - The Sections
https://git-scm.com/book/en/v2
Git - The Sections
http://www.slideshare.net/nullstein/git-usage-patterns
https://git-scm.com/book/en/v2
Git - File Lifecycle
GIT Installation
git for Windows
https://git-for-windows.github.io/
https://git-scm.com/book/en/v2
Git - Commands
CLONE – an existing repository
Git – Basic Commands
Checking status of files
$ Git status
Output On branch master nothing to commit, working directory clean
Checking status of files – Untracked files – (Add a file to working dir.)
$ Git status
Output
Your branch is up-to-date with 'origin/master'.
Untracked files:
(use "git add <file>..." to include in what will be committed)
New Text Document.txt
nothing added to commit but untracked files present (use "git add" to track)
Tracking files – Add
$ git add <filename>
Output On branch master nothing to commit, working directory clean
Checking status of files – After adding file
$ git status
Output
On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage)
new file: <File Name>
Staging Modified Files (Modify a file)
If you change a previously tracked file called “CONTRIBUTING.md” and then run
your git status command again, you get something that looks like this:
$ git status
Output
Changes not staged for commit: (use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory
You have to add them again
$ git add CONTRIBUTING.md
Git – Basic Commands
Git – Basic Commands
Commit files
$ git commit
$ git commit –m
Skipping the staging area
$ git commit -a –m [applicable for tracked files]
Removing File- You have to remove it from tracked files(staging area) and then commit
$ git rm <<File name>>
$ git commit
Commit History -
$ git logs
Unstaging staged file
$ git reset HEAD CONTRIBUTING.md
Unmodifying a Modified File
$ git checkout -- CONTRIBUTING.md
Git - Branching
Git - Merging
Git – Working with remote
$ git remote –v
$ git remote add origin (remote name) http://github.com/somrepo.git
$ git pull origin (remote) master (branch) {git fetch and merge}
$ git push origin (remote) master (branch)
Git - Ignoring files
.gitignore
Git - On the server
Git - IDE Plugins
Git – Online Exercises
• http://pcottle.github.io/learngitBranching/
• https://try.github.io/levels/1/challenges/1
• https://www.codeschool.com/courses/git-real
Git - Further Reading
• PRO GIT (Beginner)
https://git-scm.com/book/en/v2
• Git Pocket Guide (Advanced)
http://www.amazon.in/Git-Pocket-Guide-Richard-Silverman/dp/935110236X
Git - Always Remember – git never forgets!
There are a lot of great things about Git, but one feature that can cause issues is the fact that a git clone
downloads the entire history of the project, including every version of every file.
This is fine if the whole thing is source code, because Git is highly optimized to compress that data
efficiently.
However, if someone at any point in the history of your project added a single huge file, every clone for all
time will be forced to download that large file, even if it was removed from the project in the very next
commit. Because it’s reachable from the history, it will always be there.
https://rtyley.github.io/bfg-repo-cleaner/
https://git-scm.com/book/en/v2

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
Introduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training SessionIntroduction to Gitlab | Gitlab 101 | Training Session
Introduction to Gitlab | Gitlab 101 | Training Session
 
git and github
git and githubgit and github
git and github
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
Git basics
Git basicsGit basics
Git basics
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Git basics to advance with diagrams
Git basics to advance with diagramsGit basics to advance with diagrams
Git basics to advance with diagrams
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Git and Github Session
Git and Github SessionGit and Github Session
Git and Github Session
 
Git and GitHub
Git and GitHubGit and GitHub
Git and GitHub
 
Introduction to Git / Github
Introduction to Git / GithubIntroduction to Git / Github
Introduction to Git / Github
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 

Andere mochten auch

Sys05 uso consapevole di git - beyond the basic
Sys05   uso consapevole di git - beyond the basicSys05   uso consapevole di git - beyond the basic
Sys05 uso consapevole di git - beyond the basic
DotNetCampus
 
Introduzione a GIT - Laboratorio di Web Design 2014/15
Introduzione a GIT - Laboratorio di Web Design 2014/15Introduzione a GIT - Laboratorio di Web Design 2014/15
Introduzione a GIT - Laboratorio di Web Design 2014/15
Giovanni Buffa
 

Andere mochten auch (20)

Machine learning – 101
Machine learning – 101Machine learning – 101
Machine learning – 101
 
Message Oriented Middleware
Message Oriented MiddlewareMessage Oriented Middleware
Message Oriented Middleware
 
How to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
 
Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners Git 101: Git and GitHub for Beginners
Git 101: Git and GitHub for Beginners
 
Perchè Git?
Perchè Git?Perchè Git?
Perchè Git?
 
Git–SVN
Git–SVNGit–SVN
Git–SVN
 
Sys05 uso consapevole di git - beyond the basic
Sys05   uso consapevole di git - beyond the basicSys05   uso consapevole di git - beyond the basic
Sys05 uso consapevole di git - beyond the basic
 
Linux Day 2015 Genova
Linux Day 2015 GenovaLinux Day 2015 Genova
Linux Day 2015 Genova
 
GITT (part 1 of 2)
GITT (part 1 of 2)GITT (part 1 of 2)
GITT (part 1 of 2)
 
Introduzione a GIT - Laboratorio di Web Design 2014/15
Introduzione a GIT - Laboratorio di Web Design 2014/15Introduzione a GIT - Laboratorio di Web Design 2014/15
Introduzione a GIT - Laboratorio di Web Design 2014/15
 
GitSlides
GitSlidesGitSlides
GitSlides
 
Introduzione a git
Introduzione a gitIntroduzione a git
Introduzione a git
 
Git best practices
Git best practicesGit best practices
Git best practices
 
Introduzione a Git
Introduzione a GitIntroduzione a Git
Introduzione a Git
 
Git e Git Flow
Git e Git Flow Git e Git Flow
Git e Git Flow
 
Mini git tutorial
Mini git tutorialMini git tutorial
Mini git tutorial
 
Anatomia di un progetto open-source
Anatomia di un progetto open-sourceAnatomia di un progetto open-source
Anatomia di un progetto open-source
 
Controllo di versione e Git
Controllo di versione e GitControllo di versione e Git
Controllo di versione e Git
 
Git基礎介紹
Git基礎介紹Git基礎介紹
Git基礎介紹
 
Git in a nutshell
Git in a nutshellGit in a nutshell
Git in a nutshell
 

Ähnlich wie Git - An Introduction

Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
Brian K. Vagnini
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
Things Lab
 

Ähnlich wie Git - An Introduction (20)

Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)
 
Working in Team using Git in Unity
Working in Team using Git in UnityWorking in Team using Git in Unity
Working in Team using Git in Unity
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
GIT from n00b
GIT from n00bGIT from n00b
GIT from n00b
 
Git introduction
Git introductionGit introduction
Git introduction
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Git basics
Git basicsGit basics
Git basics
 
Introduction into Git
Introduction into GitIntroduction into Git
Introduction into Git
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Git Obstacle Course: Stop BASHing your head and break down the basics
Git Obstacle Course: Stop BASHing your head and break down the basicsGit Obstacle Course: Stop BASHing your head and break down the basics
Git Obstacle Course: Stop BASHing your head and break down the basics
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
 
Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615Intro to Git DevOps Tally Presentation 101615
Intro to Git DevOps Tally Presentation 101615
 
Git
GitGit
Git
 
Git: be social
Git: be socialGit: be social
Git: be social
 
Git
GitGit
Git
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Git and Github workshop GDSC MLRITM
Git and Github  workshop GDSC MLRITMGit and Github  workshop GDSC MLRITM
Git and Github workshop GDSC MLRITM
 
Source Code Management with Git
Source Code Management with GitSource Code Management with Git
Source Code Management with Git
 

Kürzlich hochgeladen

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 

Kürzlich hochgeladen (20)

Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

Git - An Introduction

  • 1. - Behzad Altaf A 2-3-5-7-11-13…-r
  • 2. Agenda • Version Control • What • Why • Types • How • Git • History • Fundamentals • Basic Commands • Branching • Working with remote • Further reading/ references • Tips
  • 3.
  • 4. Version Control • In computer software engineering, revision control is any kind of practice that tracks and provides control over changes to source code. • 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. https://en.wikipedia.org/wiki/Version_control
  • 6. Version Control – Why? http://www.webdesignerdepot.com/2009/03/intro-to-git-for-web-designers/
  • 8. Version Control - Local https://git-scm.com/book/en/v2
  • 9. Version Control - Centralized https://git-scm.com/book/en/v2
  • 10. Version Control - Distributed https://git-scm.com/book/en/v2
  • 11. Version Control - options
  • 12.
  • 13. What is git? Distributed Performant Reliable
  • 14. Git – History • The Linux kernel is an open source software project of fairly large scope. For most of the lifetime of the Linux kernel maintenance (1991–2002), changes to the software were passed around as patches and archived files. In 2002, the Linux kernel project began using a proprietary DVCS called BitKeeper. • In 2005, the relationship between the community that developed the Linux kernel and the commercial company that developed BitKeeper broke down, and the tool’s free-of-charge status was revoked. This prompted the Linux development community (and in particular Linus Torvalds, the creator of Linux) to develop their own tool based on some of the lessons they learned while using BitKeeper. https://git-scm.com/book/en/v2
  • 15. Git - Data Storage Storing data as changes to a base version of each file. Storing data as snapshots of the project over time. https://git-scm.com/book/en/v2
  • 16. Git - The Sections https://git-scm.com/book/en/v2
  • 17. Git - The Sections http://www.slideshare.net/nullstein/git-usage-patterns
  • 19. GIT Installation git for Windows https://git-for-windows.github.io/ https://git-scm.com/book/en/v2
  • 20. Git - Commands CLONE – an existing repository
  • 21. Git – Basic Commands Checking status of files $ Git status Output On branch master nothing to commit, working directory clean Checking status of files – Untracked files – (Add a file to working dir.) $ Git status Output Your branch is up-to-date with 'origin/master'. Untracked files: (use "git add <file>..." to include in what will be committed) New Text Document.txt nothing added to commit but untracked files present (use "git add" to track)
  • 22. Tracking files – Add $ git add <filename> Output On branch master nothing to commit, working directory clean Checking status of files – After adding file $ git status Output On branch master Changes to be committed: (use "git reset HEAD <file>..." to unstage) new file: <File Name> Staging Modified Files (Modify a file) If you change a previously tracked file called “CONTRIBUTING.md” and then run your git status command again, you get something that looks like this: $ git status Output Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git checkout -- <file>..." to discard changes in working directory You have to add them again $ git add CONTRIBUTING.md Git – Basic Commands
  • 23. Git – Basic Commands Commit files $ git commit $ git commit –m Skipping the staging area $ git commit -a –m [applicable for tracked files] Removing File- You have to remove it from tracked files(staging area) and then commit $ git rm <<File name>> $ git commit Commit History - $ git logs Unstaging staged file $ git reset HEAD CONTRIBUTING.md Unmodifying a Modified File $ git checkout -- CONTRIBUTING.md
  • 26. Git – Working with remote $ git remote –v $ git remote add origin (remote name) http://github.com/somrepo.git $ git pull origin (remote) master (branch) {git fetch and merge} $ git push origin (remote) master (branch)
  • 27. Git - Ignoring files .gitignore
  • 28. Git - On the server
  • 29. Git - IDE Plugins
  • 30. Git – Online Exercises • http://pcottle.github.io/learngitBranching/ • https://try.github.io/levels/1/challenges/1 • https://www.codeschool.com/courses/git-real
  • 31. Git - Further Reading • PRO GIT (Beginner) https://git-scm.com/book/en/v2 • Git Pocket Guide (Advanced) http://www.amazon.in/Git-Pocket-Guide-Richard-Silverman/dp/935110236X
  • 32. Git - Always Remember – git never forgets! There are a lot of great things about Git, but one feature that can cause issues is the fact that a git clone downloads the entire history of the project, including every version of every file. This is fine if the whole thing is source code, because Git is highly optimized to compress that data efficiently. However, if someone at any point in the history of your project added a single huge file, every clone for all time will be forced to download that large file, even if it was removed from the project in the very next commit. Because it’s reachable from the history, it will always be there. https://rtyley.github.io/bfg-repo-cleaner/ https://git-scm.com/book/en/v2