SlideShare une entreprise Scribd logo
1  sur  54
Télécharger pour lire hors ligne
Introduction to
Git version control
Gathered and Presented by: Morteza Taghaddomi
Edited by: Mohammad Amin Parchami
Based on: www.atlassian.com/git/tutorials
All content is licensed under the Creative Commons Attribution 2.5 Australia License.
K. N. Toosi University of Technology

System Analysis and Design 

Dr. Mehdi Esnaashari 

Computer Engineering (Artificial Intelligence)

Fall 2020
Before we start...
Live Demo!
Tools:
● VSCode
● Gitlab
● Git
3/54
● What is version control system?
● Benefits of version control systems
● What is git?
● Why Git for your organization?
○ Git for Developers
● What is Repository?
● Initializing a new repository
● Saving changes to the repository
● Not remembering your changes?
● Practice 1
Outline
4/54
● .gitignore
● Collaborating
○ Git remote
■ The origin Remote
○ git clone
○ git push
○ git pull
● summary
● Practice 2
● You do not want to miss out on these
Outline
5/54
What is Version Control?
6/54
What is
Version
Control?
7/54
What is Version Control?
● A category of software tools that help a software team manage
changes to source code over time.
● Keeps track of every modification to the code in a special kind of
database.
○ If a mistake is made, developers can turn back the clock and
compare earlier versions of the code to help fix the mistake
while minimizing disruption to all team members.
8/54
Benefits of version control systems
● Developing software without using version control is risky,
like not having backups.
● It enables developers to move faster.
● It Allows software teams to preserve efficiency and agility as
the team scales to include more developers.
9/54
Benefits of version control systems
● A complete long-term modification history of every file
○ Changes by whom, when and why!
● Branching and merging
○ Handles Conflicts
● Traceability
○ Jira
10/54
11/54
What is Git?
Performance / Security / Flexibility
Distributed Version control with Git
12/54
What is Git?
● Git is the most widely used modern version control system in the
world today.
● An open-source project originally developed in 2005 by Linus Torvalds.
● Every developer's working copy of the code is also a repository that can
contain the full history of all changes.
● Git has been designed with performance, security and flexibility in
mind. 13/54
Why Git for your organization?
● Git for developers
● Git for marketing
● Git for product management
● Git for designers
● Git for customer support
● Git for human resources
● Git for anyone managing a budget
14/54
15
Git for Developers
● Feature Branch Workflow
One of the biggest advantages of Git
is its branching capabilities. Unlike
centralized version control systems,
Git branches are cheap and easy to
merge. This facilitates the feature
branch workflow popular with many
Git users.
16/54
Feature Branch Workflow
● When a developer wants to start
working on something—no
matter how big or small—they
create a new branch. This
ensures that the master branch
always contains
production-quality code.
17/54
Feature Branch Workflow
● They let you represent
development work at the
same granularity as your
agile backlog.
18/54
Distributed Development
19/54
Pull Requests
● A pull request is a way
to ask another
developer to merge
one of your branches
into their repository.
20/54
Pull Requests
● This not only makes it easier for
project leads to keep track of
changes, but also lets developers
initiate discussions around their work
before integrating it with the rest of
the codebase.
21/54
Pull Requests
● When a developer gets stuck with a hard
problem, they can open a pull request to
ask for help from the rest of the team.
● junior developers can be confident that
they aren’t destroying the entire project
by treating pull requests as a formal code
review.
22/54
Community
23/54
Faster Release Cycle
● These capabilities facilitate an
agile workflow where
developers are encouraged to
share smaller changes more
frequently.
● In turn, changes can get pushed
down the deployment pipeline
faster
24/54
Git Concepts
● So far we learned what is a Version Control System (VCS),
what is Git, why should we learn it and what are its usages.
● Now we look deeper into its core features.
25/54
Repository
● What is a repository?
● Initializing a new Git repository
● Committing a modified version of a file to the repository
● Cloning an existing Git repository
● Configuring a Git repository for remote collaboration
● Common Git version control commands
26/54
What is a Git repository?
● A Git repository is a virtual
storage of your project.
● It allows you to save versions of
your code, which you can
access whenever needed.
27/54
Initializing a new repository: git init
● To create a new repository,
you'll use the git init command.
● git init is a one-time command
you use during the initial setup
of a new repository.
28/54
Initializing a new repository: git init
● Executing this command will
create a new .git subdirectory
in your current working
directory.
● This will also create a new
master branch.
29/54
● It can be used to convert an existing,
unversioned project to a Git repository or
initialize a new, empty repository.
● Executing git init creates a .git subdirectory
in the current working directory, which
contains all of the necessary Git metadata
for the new repository.
Initializing a new repository: git init
30/54
Saving changes to the repository:
git add and git commit
● git add: adds a change in the working
directory to the staging area. It tells Git
that you want to include updates of a
particular file.
● git commit: captures a snapshot of the
project's currently staged changes.
31/54
Saving changes to the repository:
git add and git commit
git add, git status, and git commit
are all used in combination to
save a snapshot of a Git project's
current state.
32/54
Saving changes to the repository:
Instructions:
● git add file1 file2 ...
● git add -a
● git add .
● git add *.py
● git commit -m "my clear and to-the-point commit message"
● git status
● git log
● git log --oneline
33/54
Not remembering your changes?
● git diff
● git diff file1
34/54
Practice 1
1. Make a new folder.
2. Create a new repository.
3. Add new files to the directory.
4. Save the change to the repository.
● check repo status after each level.
35/54
.gitignore
● Ignored files are tracked in a special file named .gitignore
that is checked in at the root of your repository.
● Usually log files, IDE settings and environment variables
should ignored.
● Configuring it right at the beginning may save you some
time! 36/54
Collaborating
git syncing:
● git remote
● git fetch
● git push
● git pull
37/54
Git remote
The git remote command
lets you create, view, and
delete connections to
other repositories.
38/54
Add remote connection
● git remote add <name> <url>
● Create a new connection to a remote
repository.
● After adding a remote, you’ll be able to
use as a convenient shortcut for in other
Git commands.
39/54
git clone
● git clone <url>
● git clone is primarily used to point
to an existing repo and make a
clone or copy of that repo at in a
new directory, at another location.
40/54
The origin Remote
● When you clone a repository
with git clone, it automatically
creates a remote connection
called origin pointing back to
the cloned repository.
41/54
git push
● The git push command is used to
upload local repository content
to a remote repository.
● Pushing is how you transfer
commits from your local
repository to a remote repo.
42/54
git push
● git push is most commonly used to
publish an upload local changes to a
central repository.
● After a local repository has been
modified a push is executed to share
the modifications with remote team
members.
● git push can be considered as an
“upload” command
43/54
Before and after push
44/54
45/54
git pull
● git pull command is used to fetch and
download content from a remote
repository,
● and immediately update the local
repository to match that content.
● becoming aware of latest changes,
new branches, etc.
46/54
git pull
Before:
47/54
git pull
Pulling:
48/54
git pull
After:
49/54
Conflicts!
50/54
Summary
51/54source: https://www.cs.swarthmore.edu/git/
Instructions:
git remote add origin <name> <url>
git clone <url>
git push origin master
git pull origin master
git push -u origin master
52/54
Practice 2
1. Save your change from practice 1, to a remote
repository such as gitlab, github or bitbucket.
2. Add some changes to it.
3. Add new changes from another repository.
4. Sync local repository with remote repository.
53/54
You do not want to miss out on these
● Efficient ways of solving conflicts.
● Git cheat sheet
54/54

Contenu connexe

Tendances (20)

Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
A Practical Introduction to git
A Practical Introduction to gitA Practical Introduction to git
A Practical Introduction to git
 
Git training
Git trainingGit training
Git training
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Git-flow workflow and pull-requests
Git-flow workflow and pull-requestsGit-flow workflow and pull-requests
Git-flow workflow and pull-requests
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Tutorial Git
Tutorial GitTutorial Git
Tutorial Git
 
Git flow Introduction
Git flow IntroductionGit flow Introduction
Git flow Introduction
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
Git basics
Git basicsGit basics
Git basics
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
git and github
git and githubgit and github
git and github
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Learning git
Learning gitLearning git
Learning git
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 
Git advanced
Git advancedGit advanced
Git advanced
 

Similaire à Git introduction for Beginners

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, TrivandrumAbhijitNarayan2
 
Git Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdfGit Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdfuzair
 
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)GDSCNiT
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administrationShawn Doyle
 
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 ArticlePRIYATHAMDARISI
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.WordCamp Harare
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHubDSCVSSUT
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow Sebin Benjamin
 

Similaire à Git introduction for Beginners (20)

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
 
Git presentation
Git presentationGit presentation
Git presentation
 
Lets git to it
Lets git to itLets git to it
Lets git to it
 
Git Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdfGit Tutorial A Comprehensive Guide for Beginners.pdf
Git Tutorial A Comprehensive Guide for Beginners.pdf
 
Git
GitGit
Git
 
Day 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptxDay 2_ Get Git with It! A Developer's Workshop.pptx
Day 2_ Get Git with It! A Developer's Workshop.pptx
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git and GitHub Info Session
Git and GitHub Info SessionGit and GitHub Info Session
Git and GitHub Info Session
 
Hacktoberfest 2022
Hacktoberfest 2022Hacktoberfest 2022
Hacktoberfest 2022
 
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
Open Sprintera (Where Open Source Sparks a Sprint of Possibilities)
 
Git: Git'ing the Basic
Git: Git'ing the BasicGit: Git'ing the Basic
Git: Git'ing the Basic
 
Formation git
Formation gitFormation git
Formation git
 
Introduction to git administration
Introduction to git administrationIntroduction to git administration
Introduction to git administration
 
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 Demo
Git DemoGit Demo
Git Demo
 
Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.Using Git with WordPress - Presented by Nigel Rodgers.
Using Git with WordPress - Presented by Nigel Rodgers.
 
finall_(1).pptx
finall_(1).pptxfinall_(1).pptx
finall_(1).pptx
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Workshop on Git and GitHub
Workshop on Git and GitHubWorkshop on Git and GitHub
Workshop on Git and GitHub
 
Introducing Git and git flow
Introducing Git and git flow Introducing Git and git flow
Introducing Git and git flow
 

Dernier

Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
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...ICS
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
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 Modelsaagamshah0812
 
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 CCTVshikhaohhpro
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 

Dernier (20)

Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
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...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
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
 
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
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 

Git introduction for Beginners

  • 1. Introduction to Git version control Gathered and Presented by: Morteza Taghaddomi Edited by: Mohammad Amin Parchami Based on: www.atlassian.com/git/tutorials All content is licensed under the Creative Commons Attribution 2.5 Australia License.
  • 2. K. N. Toosi University of Technology
 System Analysis and Design 
 Dr. Mehdi Esnaashari 
 Computer Engineering (Artificial Intelligence)
 Fall 2020
  • 3. Before we start... Live Demo! Tools: ● VSCode ● Gitlab ● Git 3/54
  • 4. ● What is version control system? ● Benefits of version control systems ● What is git? ● Why Git for your organization? ○ Git for Developers ● What is Repository? ● Initializing a new repository ● Saving changes to the repository ● Not remembering your changes? ● Practice 1 Outline 4/54
  • 5. ● .gitignore ● Collaborating ○ Git remote ■ The origin Remote ○ git clone ○ git push ○ git pull ● summary ● Practice 2 ● You do not want to miss out on these Outline 5/54
  • 6. What is Version Control? 6/54
  • 8. What is Version Control? ● A category of software tools that help a software team manage changes to source code over time. ● Keeps track of every modification to the code in a special kind of database. ○ If a mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the mistake while minimizing disruption to all team members. 8/54
  • 9. Benefits of version control systems ● Developing software without using version control is risky, like not having backups. ● It enables developers to move faster. ● It Allows software teams to preserve efficiency and agility as the team scales to include more developers. 9/54
  • 10. Benefits of version control systems ● A complete long-term modification history of every file ○ Changes by whom, when and why! ● Branching and merging ○ Handles Conflicts ● Traceability ○ Jira 10/54
  • 11. 11/54
  • 12. What is Git? Performance / Security / Flexibility Distributed Version control with Git 12/54
  • 13. What is Git? ● Git is the most widely used modern version control system in the world today. ● An open-source project originally developed in 2005 by Linus Torvalds. ● Every developer's working copy of the code is also a repository that can contain the full history of all changes. ● Git has been designed with performance, security and flexibility in mind. 13/54
  • 14. Why Git for your organization? ● Git for developers ● Git for marketing ● Git for product management ● Git for designers ● Git for customer support ● Git for human resources ● Git for anyone managing a budget 14/54
  • 15. 15
  • 16. Git for Developers ● Feature Branch Workflow One of the biggest advantages of Git is its branching capabilities. Unlike centralized version control systems, Git branches are cheap and easy to merge. This facilitates the feature branch workflow popular with many Git users. 16/54
  • 17. Feature Branch Workflow ● When a developer wants to start working on something—no matter how big or small—they create a new branch. This ensures that the master branch always contains production-quality code. 17/54
  • 18. Feature Branch Workflow ● They let you represent development work at the same granularity as your agile backlog. 18/54
  • 20. Pull Requests ● A pull request is a way to ask another developer to merge one of your branches into their repository. 20/54
  • 21. Pull Requests ● This not only makes it easier for project leads to keep track of changes, but also lets developers initiate discussions around their work before integrating it with the rest of the codebase. 21/54
  • 22. Pull Requests ● When a developer gets stuck with a hard problem, they can open a pull request to ask for help from the rest of the team. ● junior developers can be confident that they aren’t destroying the entire project by treating pull requests as a formal code review. 22/54
  • 24. Faster Release Cycle ● These capabilities facilitate an agile workflow where developers are encouraged to share smaller changes more frequently. ● In turn, changes can get pushed down the deployment pipeline faster 24/54
  • 25. Git Concepts ● So far we learned what is a Version Control System (VCS), what is Git, why should we learn it and what are its usages. ● Now we look deeper into its core features. 25/54
  • 26. Repository ● What is a repository? ● Initializing a new Git repository ● Committing a modified version of a file to the repository ● Cloning an existing Git repository ● Configuring a Git repository for remote collaboration ● Common Git version control commands 26/54
  • 27. What is a Git repository? ● A Git repository is a virtual storage of your project. ● It allows you to save versions of your code, which you can access whenever needed. 27/54
  • 28. Initializing a new repository: git init ● To create a new repository, you'll use the git init command. ● git init is a one-time command you use during the initial setup of a new repository. 28/54
  • 29. Initializing a new repository: git init ● Executing this command will create a new .git subdirectory in your current working directory. ● This will also create a new master branch. 29/54
  • 30. ● It can be used to convert an existing, unversioned project to a Git repository or initialize a new, empty repository. ● Executing git init creates a .git subdirectory in the current working directory, which contains all of the necessary Git metadata for the new repository. Initializing a new repository: git init 30/54
  • 31. Saving changes to the repository: git add and git commit ● git add: adds a change in the working directory to the staging area. It tells Git that you want to include updates of a particular file. ● git commit: captures a snapshot of the project's currently staged changes. 31/54
  • 32. Saving changes to the repository: git add and git commit git add, git status, and git commit are all used in combination to save a snapshot of a Git project's current state. 32/54
  • 33. Saving changes to the repository: Instructions: ● git add file1 file2 ... ● git add -a ● git add . ● git add *.py ● git commit -m "my clear and to-the-point commit message" ● git status ● git log ● git log --oneline 33/54
  • 34. Not remembering your changes? ● git diff ● git diff file1 34/54
  • 35. Practice 1 1. Make a new folder. 2. Create a new repository. 3. Add new files to the directory. 4. Save the change to the repository. ● check repo status after each level. 35/54
  • 36. .gitignore ● Ignored files are tracked in a special file named .gitignore that is checked in at the root of your repository. ● Usually log files, IDE settings and environment variables should ignored. ● Configuring it right at the beginning may save you some time! 36/54
  • 37. Collaborating git syncing: ● git remote ● git fetch ● git push ● git pull 37/54
  • 38. Git remote The git remote command lets you create, view, and delete connections to other repositories. 38/54
  • 39. Add remote connection ● git remote add <name> <url> ● Create a new connection to a remote repository. ● After adding a remote, you’ll be able to use as a convenient shortcut for in other Git commands. 39/54
  • 40. git clone ● git clone <url> ● git clone is primarily used to point to an existing repo and make a clone or copy of that repo at in a new directory, at another location. 40/54
  • 41. The origin Remote ● When you clone a repository with git clone, it automatically creates a remote connection called origin pointing back to the cloned repository. 41/54
  • 42. git push ● The git push command is used to upload local repository content to a remote repository. ● Pushing is how you transfer commits from your local repository to a remote repo. 42/54
  • 43. git push ● git push is most commonly used to publish an upload local changes to a central repository. ● After a local repository has been modified a push is executed to share the modifications with remote team members. ● git push can be considered as an “upload” command 43/54
  • 44. Before and after push 44/54
  • 45. 45/54
  • 46. git pull ● git pull command is used to fetch and download content from a remote repository, ● and immediately update the local repository to match that content. ● becoming aware of latest changes, new branches, etc. 46/54
  • 52. Instructions: git remote add origin <name> <url> git clone <url> git push origin master git pull origin master git push -u origin master 52/54
  • 53. Practice 2 1. Save your change from practice 1, to a remote repository such as gitlab, github or bitbucket. 2. Add some changes to it. 3. Add new changes from another repository. 4. Sync local repository with remote repository. 53/54
  • 54. You do not want to miss out on these ● Efficient ways of solving conflicts. ● Git cheat sheet 54/54