SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

PDF
Git Tutorial 教學
Wen-Tien Chang
 
PDF
Git tutorial
Elli Kanal
 
PDF
Git and github 101
Senthilkumar Gopal
 
PDF
COUPROD - Un logiciel pour vulgariser le calcul des coûts de production
Institut de l'Elevage - Idele
 
PDF
Git由超淺入超深
羊 小咩 (lamb-mei)
 
PPTX
Git tutorial
Pham Quy (Jack)
 
PPTX
Git One Day Training Notes
glen_a_smith
 
PDF
Git and git flow
Fran García
 
PDF
Delivering Quality at Speed with GitOps
Weaveworks
 
PPT
Introduction to Git and Github
Somkiat Puisungnoen
 
PDF
Git 더하기 GitHub(Git클라이언트 활용) / Getting started with git+github
Junyoung Lee
 
PDF
A Practical Introduction to git
Emanuele Olivetti
 
PPTX
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Rueful Robin
 
PDF
Git e GitHub - L'essenziale
Gemma Catolino
 
PPT
MÉTODOS DE DIAGNÓSTICO NA MTC
Elva Judy Nieri
 
PDF
Gitのよく使うコマンド
YUKI Kaoru
 
PDF
Git Introduction Tutorial
Thomas Rausch
 
PPTX
Git&GitHub.pptx
KondiVenkatesh1
 
PDF
Version Control with Git & GitHub
Piet Cordemans
 
PPTX
A painless self-hosted Git service: Gitea
Bo-Yi Wu
 
Git Tutorial 教學
Wen-Tien Chang
 
Git tutorial
Elli Kanal
 
Git and github 101
Senthilkumar Gopal
 
COUPROD - Un logiciel pour vulgariser le calcul des coûts de production
Institut de l'Elevage - Idele
 
Git由超淺入超深
羊 小咩 (lamb-mei)
 
Git tutorial
Pham Quy (Jack)
 
Git One Day Training Notes
glen_a_smith
 
Git and git flow
Fran García
 
Delivering Quality at Speed with GitOps
Weaveworks
 
Introduction to Git and Github
Somkiat Puisungnoen
 
Git 더하기 GitHub(Git클라이언트 활용) / Getting started with git+github
Junyoung Lee
 
A Practical Introduction to git
Emanuele Olivetti
 
Git and GitHub | Concept about Git and GitHub Process | Git Process overview
Rueful Robin
 
Git e GitHub - L'essenziale
Gemma Catolino
 
MÉTODOS DE DIAGNÓSTICO NA MTC
Elva Judy Nieri
 
Gitのよく使うコマンド
YUKI Kaoru
 
Git Introduction Tutorial
Thomas Rausch
 
Git&GitHub.pptx
KondiVenkatesh1
 
Version Control with Git & GitHub
Piet Cordemans
 
A painless self-hosted Git service: Gitea
Bo-Yi Wu
 

Similar to Git introduction for Beginners (20)

PDF
Git Mastery
ShehryarSH1
 
PPTX
Introduction to GitHub, Open Source and Tech Article
PRIYATHAMDARISI
 
PPTX
Git presentation
Sai Kumar Satapathy
 
PPTX
Basics of git
Ahmed Al-sabsab
 
PDF
Git Tutorial
Ahmed Taha
 
PPTX
GIT INTRODUCTION
MohanRaviRohitth
 
PDF
Rc094 010d-git 2 - desconocido
Luis Bertel
 
PDF
Introduction-to-Git-Github-andWorshop.pdf
SwasKare
 
PDF
Git Pocket Guide A Working Introduction 1st Edition Richard E. Silverman
fingonbinka66
 
PPTX
Version Control with Git
Sahil Agarwal
 
PPTX
Git Basics for Software Version Management
ishanmittal49
 
PDF
Mini git tutorial
Cristian Lucchesi
 
PPTX
Version controll.pptx
Md. Main Uddin Rony
 
PPT
3 Git
Fabio Fumarola
 
PDF
Software Engineering Tools and Practices Learn Git
BeHappy728244
 
KEY
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
PPT
Git
zafarfaizi
 
PPT
Git
Vijay Kani
 
PPT
Git
Alf Chang
 
Git Mastery
ShehryarSH1
 
Introduction to GitHub, Open Source and Tech Article
PRIYATHAMDARISI
 
Git presentation
Sai Kumar Satapathy
 
Basics of git
Ahmed Al-sabsab
 
Git Tutorial
Ahmed Taha
 
GIT INTRODUCTION
MohanRaviRohitth
 
Rc094 010d-git 2 - desconocido
Luis Bertel
 
Introduction-to-Git-Github-andWorshop.pdf
SwasKare
 
Git Pocket Guide A Working Introduction 1st Edition Richard E. Silverman
fingonbinka66
 
Version Control with Git
Sahil Agarwal
 
Git Basics for Software Version Management
ishanmittal49
 
Mini git tutorial
Cristian Lucchesi
 
Version controll.pptx
Md. Main Uddin Rony
 
Software Engineering Tools and Practices Learn Git
BeHappy728244
 
Let's Git this Party Started: An Introduction to Git and GitHub
Kim Moir
 
Ad

Recently uploaded (20)

PPTX
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
PPTX
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
PPTX
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
PPTX
Human Resources Information System (HRIS)
Amity University, Patna
 
PDF
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
PDF
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
PDF
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
PDF
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PPTX
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
PPTX
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
PPTX
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
PDF
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
PPTX
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
PDF
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
PDF
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
PDF
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Platform for Enterprise Solution - Java EE5
abhishekoza1981
 
The Role of a PHP Development Company in Modern Web Development
SEO Company for School in Delhi NCR
 
Tally_Basic_Operations_Presentation.pptx
AditiBansal54083
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Fundamentals_of_Microservices_Architecture.pptx
MuhammadUzair504018
 
Human Resources Information System (HRIS)
Amity University, Patna
 
Beyond Binaries: Understanding Diversity and Allyship in a Global Workplace -...
Imma Valls Bernaus
 
Build It, Buy It, or Already Got It? Make Smarter Martech Decisions
bbedford2
 
GetOnCRM Speeds Up Agentforce 3 Deployment for Enterprise AI Wins.pdf
GetOnCRM Solutions
 
Unlock Efficiency with Insurance Policy Administration Systems
Insurance Tech Services
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
An Introduction to ZAP by Checkmarx - Official Version
Simon Bennetts
 
Migrating Millions of Users with Debezium, Apache Kafka, and an Acyclic Synch...
MD Sayem Ahmed
 
Revolutionizing Code Modernization with AI
KrzysztofKkol1
 
HiHelloHR – Simplify HR Operations for Modern Workplaces
HiHelloHR
 
A Complete Guide to Salesforce SMS Integrations Build Scalable Messaging With...
360 SMS APP
 
Capcut Pro Crack For PC Latest Version {Fully Unlocked} 2025
hashhshs786
 
Revenue streams of the Wazirx clone script.pdf
aaronjeffray
 
iTop VPN With Crack Lifetime Activation Key-CODE
utfefguu
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Ad

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