SlideShare a Scribd company logo
Brief tutorial on Git
Colin Cheng ( 鄭聖文 )
Shengwen1997.tw@gmail.com
NCTU Robotic Vision class
Outline
Begin
●
Clone a project from Internet
●
Create a git project
●
Git commit
●
Git push/pull
Intermediate
●
Branch
●
Fork a project on Github
●
Send a pull request
What is Git?
●
A version control system for project management
●
Create by Linux's author Linus Torvalds
Before you start using version
control system ...
I think I can manage
my project very well
without git
code_2016_1_1
Before you start using version
control system ...
I think I can manage
my project very well
without git
code_2016_1_1 code_2016_1_3
Before you start using version
control system ...
I think I can manage
my project very well
without git
code_2016_1_1 code_2016_1_3 code_2016_2_4
Before you start using version
control system ...
Help!
Dude…
Before you start using version
control system ...
Help!
Dude…
Inefficient!
Also, if the source code size is
too big...
My source code size is
approximately 6GB
Great! Now you know why
we need to learn Git
Outline
Begin
●
Clone a project from Internet
●
Create a git project
●
Git commit
●
Git push/pull
Intermediate
●
Branch
●
Fork a project on Github
●
Send a pull request
Example
Copy the link
https://github.com/duckietown/software
Git clone
cd ~
git clone https://github.com/duckietown/software.git
cd Software/
ls
Whereever you want to store the code, ~ means the home directory
Clone command
Outline
Begin
●
Clone a project from Internet
●
Create a git project
●
Git commit
●
Git push/pull
Intermediate
●
Branch
●
Fork a project on Github
●
Send a pull request
Git init
Suppose you have a project called “duckie”,
you have to git init the directory once before
using the git
Git init
cd ~
mkdir duckie
cd duckie/
git init
ls -a
Create new directory called duckie
Init the project with git
List all the files including the hidden file
Git stores all the informations, configurations in this floder
Outline
Begin
●
Clone a project from Internet
●
Create a git project
●
Git commit
●
Git push/pull
Intermediate
●
Branch
●
Fork a project on Github
●
Send a pull request
Setup your git user
information
git config --global user.name "user name"
git config --global user.email "email address"
Modify the file
Now, we are going to modify the file, and use
git to help us store the changes (track).
We will use vim editor, but if you are not yet
familiar with vim, you could try gedit (or
Sublime)
However, I still hope you know how to use vim
Create the file as
follow
file: duckie/hello.txt
Hello World
Git status
git status See the change in this project directory
Git found we have a new file, but not tracking yet
Git add
git add hello.txt Store the new modification
Commit
After you add all the files (if you have multiple
files to add), you can commit all the changes to
a single log
Git commit
Git commit -m ‘Create new file’ Commit description should be brief and easy
to understand!
So...
Please...
Please do not git add the *.exe file,
log file, etc…
Git should only track the source file!
Hide the file you don't
want git to track
For example:
'
Create .gitignore
You can create a .gitignore file at your project
root directory and list the file you don’t want
git to track
file: duckie/.gitignore
*.exe
Yes, you can use the regular expression!
Hide the file you dont
want to track
See:
Disappear below
See the changes log
Now, we will like to see all the changes,
We can use the program “tig”
Type the following command to install it:
sudo apt get install tig
Check the log
tig
You will see:
More
Type [Enter] to check the log, [q] to leave
Git will also generate a unique id for every commit
(SHA-1), so we can operate the commit by assinging the
id (Like invert the commit, etc)
Outline
Begin
●
Clone a project from Internet
●
Create a git project
●
Git commit
●
Git push/pull
Intermediate
●
Branch
●
Fork a project on Github
●
Send a pull request
Create github repository
Login and click the “New repository” button
Create github repository
Create github repository
Actually, you can also learn how to
create a new git project at here
Back to your consle
git remote add origin https://github.com/XXXX/duckie.git
Check the link on your github repo!
This command will help you create a remote
named “origin” and point to the github repo
Git push (Upload)
Now, you can push your code to your github
repo (remote)
Git push
Git push origin master
(git push [REMOTE] [BRANCH]), I will explain what is the branch later
Now, refresh your github
page!
Git pull
In previous, I taught you how to clone a project,
But what if the develper add new features and
You wish to keep your clone up-to-date?
Now, you need to to use the git pull command
Git pull
Git pull origin master
(git pull [REMOTE] [BRANCH])
Well, this is already up-to-date,
try this next time when you need it
Outline
Begin
●
Clone a project from Internet
●
Create a git project
●
Git commit
●
Git push/pull
Intermediate
●
Branch
●
Fork a project on Github
●
Send a pull request
Branch
In git, you can create different branches and
develop your project at the same time:
Merge
After you finish developing on certin branch,
you can merge it back to the master(or other
branch)
This is a merge
Head
Head is the latest commit on your branch,
If you are now at the master branch, this is
your Head:
Head of master
Head
And this will be the Head of the
very_nice_feature branch:
Also a Head
Some git branch commands
git branch new_branch_name ← Create a new branch
git branch ← Check current branch
git checkout branch_name ← Switch to certin branch
git merge branch_name ←merge certen branch back to the current branch
*If there is any confict during the merge, git will ask you to fix the the conflicts
Outline
Begin
●
Clone a project from Internet
●
Create a git project
●
Git commit
●
Git push/pull
Intermediate
●
Branch
●
Fork a project on Github
●
Send a pull request
Fork
Fork is a Github feature, you can fork
someone’s project and store it in your github
Repo page
Fork
Click the buttonhttps://github.com/duckietown/software
Fork
Outline
Begin
●
Clone a project from Internet
●
Create a git project
●
Git commit
●
Git push/pull
Intermediate
●
Branch
●
Fork a project on Github
●
Send a pull request
Pull request
Pull request is also a github feature.
After you fork the project, you may add more
new functions. you can send a pull request to
the original author and ask him/her to merge
your changes
Well, the author have the right to merge or
not
Pull request
Pull request
After you click the button, the Pull request will be sent

More Related Content

What's hot

Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
Anurag Upadhaya
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
Naveen Pandey
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
abodeltae
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
Suman Mukherjee
 
Tutorial Git
Tutorial GitTutorial Git
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
Vikram SV
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
Arnaud Seilles
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
Nilay Binjola
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
Fran García
 
Version control system
Version control systemVersion control system
Version control system
Andrew Liu
 
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
Mikhail Melnik
 
Understanding docker networking
Understanding docker networkingUnderstanding docker networking
Understanding docker networking
Lorenzo Fontana
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Colin Su
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
Senthilkumar Gopal
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching Strategy
Vivek Parihar
 
Introduction git
Introduction gitIntroduction git
Introduction git
Dian Sigit Prastowo
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
Mediacurrent
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
Sage Sharp
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
Venkat Malladi
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
glen_a_smith
 

What's hot (20)

Git 101 for Beginners
Git 101 for Beginners Git 101 for Beginners
Git 101 for Beginners
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
A successful Git branching model
A successful Git branching model A successful Git branching model
A successful Git branching model
 
Git vs svn
Git vs svnGit vs svn
Git vs svn
 
Tutorial Git
Tutorial GitTutorial Git
Tutorial Git
 
Introduction to Git and GitHub
Introduction to Git and GitHubIntroduction to Git and GitHub
Introduction to Git and GitHub
 
Introduction To Git
Introduction To GitIntroduction To Git
Introduction To Git
 
Git - Basic Crash Course
Git - Basic Crash CourseGit - Basic Crash Course
Git - Basic Crash Course
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Version control system
Version control systemVersion control system
Version control system
 
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
 
Understanding docker networking
Understanding docker networkingUnderstanding docker networking
Understanding docker networking
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
A Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching StrategyA Git Workflow Model or Branching Strategy
A Git Workflow Model or Branching Strategy
 
Introduction git
Introduction gitIntroduction git
Introduction git
 
Git flow for daily use
Git flow for daily useGit flow for daily use
Git flow for daily use
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Intro to git and git hub
Intro to git and git hubIntro to git and git hub
Intro to git and git hub
 
Git One Day Training Notes
Git One Day Training NotesGit One Day Training Notes
Git One Day Training Notes
 

Viewers also liked

atan2 brief explain
atan2 brief explainatan2 brief explain
atan2 brief explain
聖文 鄭
 
The Chest Coach System
The Chest Coach SystemThe Chest Coach System
The Chest Coach System
jamed749
 
12-Factor App
12-Factor App12-Factor App
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
Amazon Web Services
 
Heroku Javaで12-Factor App
Heroku Javaで12-Factor App Heroku Javaで12-Factor App
Heroku Javaで12-Factor App
Mitch Okamoto
 
12 factor app an introduction
12 factor app an introduction12 factor app an introduction
12 factor app an introduction
Krishna-Kumar
 
12-Factor
12-Factor12-Factor
12-Factor
Luc Juggery
 
Advanced Git
Advanced GitAdvanced Git
Advanced Gitsegv
 
AWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web ServicesAWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web Services
Amazon Web Services
 
Continuous Innovation + Digital Platforms
Continuous Innovation + Digital PlatformsContinuous Innovation + Digital Platforms
Continuous Innovation + Digital Platforms
Cloud Foundry Foundation
 
AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)
Amazon Web Services
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web Services
Amazon Web Services
 
Deep C
Deep CDeep C
Deep C
Olve Maudal
 

Viewers also liked (13)

atan2 brief explain
atan2 brief explainatan2 brief explain
atan2 brief explain
 
The Chest Coach System
The Chest Coach SystemThe Chest Coach System
The Chest Coach System
 
12-Factor App
12-Factor App12-Factor App
12-Factor App
 
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
(DVO308) Docker & ECS in Production: How We Migrated Our Infrastructure from ...
 
Heroku Javaで12-Factor App
Heroku Javaで12-Factor App Heroku Javaで12-Factor App
Heroku Javaで12-Factor App
 
12 factor app an introduction
12 factor app an introduction12 factor app an introduction
12 factor app an introduction
 
12-Factor
12-Factor12-Factor
12-Factor
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
AWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web ServicesAWS Webcast - Getting Started with Amazon Web Services
AWS Webcast - Getting Started with Amazon Web Services
 
Continuous Innovation + Digital Platforms
Continuous Innovation + Digital PlatformsContinuous Innovation + Digital Platforms
Continuous Innovation + Digital Platforms
 
AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)AWS 101: Cloud Computing Seminar (2012)
AWS 101: Cloud Computing Seminar (2012)
 
Introduction to Amazon Web Services
Introduction to Amazon Web ServicesIntroduction to Amazon Web Services
Introduction to Amazon Web Services
 
Deep C
Deep CDeep C
Deep C
 

Similar to Brief tutorial on Git

introductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdfintroductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdf
BruceLee275640
 
Git & Github
Git & GithubGit & Github
Git & Github
Aman Lalpuria
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdf
GDSCKNUST
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
Aderemi Dadepo
 
Git and Github.pptx
Git and Github.pptxGit and Github.pptx
Git and Github.pptx
Hitesh670643
 
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GIT
GhadiAlGhosh
 
Formation git
Formation gitFormation git
Formation git
Ghariani Tewfik
 
Git presentation
Git presentationGit presentation
Git presentation
Vikas Yaligar
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
Wycliff1
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
GDSC UofT Mississauga
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
16 Git
16 Git16 Git
14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx
GDSCGHRIETNagpur
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
Manish Suwal 'Enwil'
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
Nyros Technologies
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
Yan Vugenfirer
 
GDSC Git event 2023.pptx
GDSC Git event 2023.pptxGDSC Git event 2023.pptx
GDSC Git event 2023.pptx
fsxflyer789Productio
 
Git Basics
Git BasicsGit Basics
Git Basics
Ryan Condron
 
A Tutorial for GitHub.pdf
A Tutorial for GitHub.pdfA Tutorial for GitHub.pdf
A Tutorial for GitHub.pdf
badrfathallah2
 
A Tutorial for GitHub.pdf
A Tutorial for GitHub.pdfA Tutorial for GitHub.pdf
A Tutorial for GitHub.pdf
Amarnadh36
 

Similar to Brief tutorial on Git (20)

introductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdfintroductiontogitandgithub-120702044048-phpapp01.pdf
introductiontogitandgithub-120702044048-phpapp01.pdf
 
Git & Github
Git & GithubGit & Github
Git & Github
 
Beginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdfBeginner Workshop for Student Developers - Tratech-presentation.pdf
Beginner Workshop for Student Developers - Tratech-presentation.pdf
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Git and Github.pptx
Git and Github.pptxGit and Github.pptx
Git and Github.pptx
 
Getting started With GIT
Getting started With GITGetting started With GIT
Getting started With GIT
 
Formation git
Formation gitFormation git
Formation git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Git Init (Introduction to Git)
Git Init (Introduction to Git)Git Init (Introduction to Git)
Git Init (Introduction to Git)
 
Intro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucketIntro to Git, GitHub, and BitBucket
Intro to Git, GitHub, and BitBucket
 
16 Git
16 Git16 Git
16 Git
 
14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx14 oct Git & GitHub.pptx
14 oct Git & GitHub.pptx
 
Using Git to Organize Your Project
Using Git to Organize Your ProjectUsing Git to Organize Your Project
Using Git to Organize Your Project
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
GDSC Git event 2023.pptx
GDSC Git event 2023.pptxGDSC Git event 2023.pptx
GDSC Git event 2023.pptx
 
Git Basics
Git BasicsGit Basics
Git Basics
 
A Tutorial for GitHub.pdf
A Tutorial for GitHub.pdfA Tutorial for GitHub.pdf
A Tutorial for GitHub.pdf
 
A Tutorial for GitHub.pdf
A Tutorial for GitHub.pdfA Tutorial for GitHub.pdf
A Tutorial for GitHub.pdf
 

Recently uploaded

Presentation on Food Delivery Systems
Presentation on Food Delivery SystemsPresentation on Food Delivery Systems
Presentation on Food Delivery Systems
Abdullah Al Noman
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
nedcocy
 
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUESAN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
drshikhapandey2022
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Transcat
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
Roger Rozario
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
PreethaV16
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
felixwold
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
Paris Salesforce Developer Group
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
upoux
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
sydezfe
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
aryanpankaj78
 
Impartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 StandardImpartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 Standard
MuhammadJazib15
 
Digital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes completeDigital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes complete
shubhamsaraswat8740
 
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdfSELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
Pallavi Sharma
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
Divyanshu
 
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICSUNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
vmspraneeth
 
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
DharmaBanothu
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
MadhavJungKarki
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
upoux
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
ijseajournal
 

Recently uploaded (20)

Presentation on Food Delivery Systems
Presentation on Food Delivery SystemsPresentation on Food Delivery Systems
Presentation on Food Delivery Systems
 
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
一比一原版(爱大毕业证书)爱荷华大学毕业证如何办理
 
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUESAN INTRODUCTION OF AI & SEARCHING TECHIQUES
AN INTRODUCTION OF AI & SEARCHING TECHIQUES
 
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
Tools & Techniques for Commissioning and Maintaining PV Systems W-Animations ...
 
Transformers design and coooling methods
Transformers design and coooling methodsTransformers design and coooling methods
Transformers design and coooling methods
 
Object Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOADObject Oriented Analysis and Design - OOAD
Object Oriented Analysis and Design - OOAD
 
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdfAsymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
Asymmetrical Repulsion Magnet Motor Ratio 6-7.pdf
 
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
AI + Data Community Tour - Build the Next Generation of Apps with the Einstei...
 
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
一比一原版(uofo毕业证书)美国俄勒冈大学毕业证如何办理
 
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
一比一原版(uoft毕业证书)加拿大多伦多大学毕业证如何办理
 
Digital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptxDigital Twins Computer Networking Paper Presentation.pptx
Digital Twins Computer Networking Paper Presentation.pptx
 
Impartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 StandardImpartiality as per ISO /IEC 17025:2017 Standard
Impartiality as per ISO /IEC 17025:2017 Standard
 
Digital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes completeDigital Image Processing Unit -2 Notes complete
Digital Image Processing Unit -2 Notes complete
 
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdfSELENIUM CONF -PALLAVI SHARMA - 2024.pdf
SELENIUM CONF -PALLAVI SHARMA - 2024.pdf
 
Null Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAMNull Bangalore | Pentesters Approach to AWS IAM
Null Bangalore | Pentesters Approach to AWS IAM
 
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICSUNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
UNIT 4 LINEAR INTEGRATED CIRCUITS-DIGITAL ICS
 
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
A high-Speed Communication System is based on the Design of a Bi-NoC Router, ...
 
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
1FIDIC-CONSTRUCTION-CONTRACT-2ND-ED-2017-RED-BOOK.pdf
 
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
一比一原版(osu毕业证书)美国俄勒冈州立大学毕业证如何办理
 
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...Call For Paper -3rd International Conference on Artificial Intelligence Advan...
Call For Paper -3rd International Conference on Artificial Intelligence Advan...
 

Brief tutorial on Git

  • 1. Brief tutorial on Git Colin Cheng ( 鄭聖文 ) Shengwen1997.tw@gmail.com NCTU Robotic Vision class
  • 2. Outline Begin ● Clone a project from Internet ● Create a git project ● Git commit ● Git push/pull Intermediate ● Branch ● Fork a project on Github ● Send a pull request
  • 3. What is Git? ● A version control system for project management ● Create by Linux's author Linus Torvalds
  • 4. Before you start using version control system ... I think I can manage my project very well without git code_2016_1_1
  • 5. Before you start using version control system ... I think I can manage my project very well without git code_2016_1_1 code_2016_1_3
  • 6. Before you start using version control system ... I think I can manage my project very well without git code_2016_1_1 code_2016_1_3 code_2016_2_4
  • 7. Before you start using version control system ... Help! Dude…
  • 8. Before you start using version control system ... Help! Dude… Inefficient!
  • 9. Also, if the source code size is too big... My source code size is approximately 6GB
  • 10. Great! Now you know why we need to learn Git
  • 11. Outline Begin ● Clone a project from Internet ● Create a git project ● Git commit ● Git push/pull Intermediate ● Branch ● Fork a project on Github ● Send a pull request
  • 13. Git clone cd ~ git clone https://github.com/duckietown/software.git cd Software/ ls Whereever you want to store the code, ~ means the home directory Clone command
  • 14. Outline Begin ● Clone a project from Internet ● Create a git project ● Git commit ● Git push/pull Intermediate ● Branch ● Fork a project on Github ● Send a pull request
  • 15. Git init Suppose you have a project called “duckie”, you have to git init the directory once before using the git
  • 16. Git init cd ~ mkdir duckie cd duckie/ git init ls -a Create new directory called duckie Init the project with git List all the files including the hidden file Git stores all the informations, configurations in this floder
  • 17. Outline Begin ● Clone a project from Internet ● Create a git project ● Git commit ● Git push/pull Intermediate ● Branch ● Fork a project on Github ● Send a pull request
  • 18. Setup your git user information git config --global user.name "user name" git config --global user.email "email address"
  • 19. Modify the file Now, we are going to modify the file, and use git to help us store the changes (track). We will use vim editor, but if you are not yet familiar with vim, you could try gedit (or Sublime) However, I still hope you know how to use vim
  • 20. Create the file as follow file: duckie/hello.txt Hello World
  • 21. Git status git status See the change in this project directory Git found we have a new file, but not tracking yet
  • 22. Git add git add hello.txt Store the new modification
  • 23. Commit After you add all the files (if you have multiple files to add), you can commit all the changes to a single log
  • 24. Git commit Git commit -m ‘Create new file’ Commit description should be brief and easy to understand!
  • 25. So...
  • 26. Please... Please do not git add the *.exe file, log file, etc… Git should only track the source file!
  • 27. Hide the file you don't want git to track For example: '
  • 28. Create .gitignore You can create a .gitignore file at your project root directory and list the file you don’t want git to track file: duckie/.gitignore *.exe Yes, you can use the regular expression!
  • 29. Hide the file you dont want to track See: Disappear below
  • 30. See the changes log Now, we will like to see all the changes, We can use the program “tig” Type the following command to install it: sudo apt get install tig
  • 32. More Type [Enter] to check the log, [q] to leave Git will also generate a unique id for every commit (SHA-1), so we can operate the commit by assinging the id (Like invert the commit, etc)
  • 33. Outline Begin ● Clone a project from Internet ● Create a git project ● Git commit ● Git push/pull Intermediate ● Branch ● Fork a project on Github ● Send a pull request
  • 34. Create github repository Login and click the “New repository” button
  • 36. Create github repository Actually, you can also learn how to create a new git project at here
  • 37. Back to your consle git remote add origin https://github.com/XXXX/duckie.git Check the link on your github repo! This command will help you create a remote named “origin” and point to the github repo
  • 38. Git push (Upload) Now, you can push your code to your github repo (remote)
  • 39. Git push Git push origin master (git push [REMOTE] [BRANCH]), I will explain what is the branch later
  • 40. Now, refresh your github page!
  • 41. Git pull In previous, I taught you how to clone a project, But what if the develper add new features and You wish to keep your clone up-to-date? Now, you need to to use the git pull command
  • 42. Git pull Git pull origin master (git pull [REMOTE] [BRANCH]) Well, this is already up-to-date, try this next time when you need it
  • 43. Outline Begin ● Clone a project from Internet ● Create a git project ● Git commit ● Git push/pull Intermediate ● Branch ● Fork a project on Github ● Send a pull request
  • 44. Branch In git, you can create different branches and develop your project at the same time:
  • 45. Merge After you finish developing on certin branch, you can merge it back to the master(or other branch) This is a merge
  • 46. Head Head is the latest commit on your branch, If you are now at the master branch, this is your Head: Head of master
  • 47. Head And this will be the Head of the very_nice_feature branch: Also a Head
  • 48. Some git branch commands git branch new_branch_name ← Create a new branch git branch ← Check current branch git checkout branch_name ← Switch to certin branch git merge branch_name ←merge certen branch back to the current branch *If there is any confict during the merge, git will ask you to fix the the conflicts
  • 49. Outline Begin ● Clone a project from Internet ● Create a git project ● Git commit ● Git push/pull Intermediate ● Branch ● Fork a project on Github ● Send a pull request
  • 50. Fork Fork is a Github feature, you can fork someone’s project and store it in your github Repo page
  • 52. Fork
  • 53. Outline Begin ● Clone a project from Internet ● Create a git project ● Git commit ● Git push/pull Intermediate ● Branch ● Fork a project on Github ● Send a pull request
  • 54. Pull request Pull request is also a github feature. After you fork the project, you may add more new functions. you can send a pull request to the original author and ask him/her to merge your changes Well, the author have the right to merge or not
  • 56. Pull request After you click the button, the Pull request will be sent