SlideShare a Scribd company logo
1 of 56
Download to read offline
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

The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitE Carter
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Gitatishgoswami
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hubNaveen Pandey
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git TutorialSage Sharp
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to GitlabJulien Pivotto
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flowKnoldus Inc.
 
Learning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdfLearning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdfJayprakash677449
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeMd Swawibe Ul Alam
 
Getting started with GitHub Desktop
Getting started with GitHub DesktopGetting started with GitHub Desktop
Getting started with GitHub DesktopAram Panasenco
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to GitLukas Fittl
 
Version control system
Version control systemVersion control system
Version control systemAndrew Liu
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in AndroidOpersys inc.
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab IntroductionKrunal Doshi
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoinWilliam Chong
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and githubAderemi Dadepo
 

What's hot (20)

The everyday developer's guide to version control with Git
The everyday developer's guide to version control with GitThe everyday developer's guide to version control with Git
The everyday developer's guide to version control with Git
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Introduction to Gitlab
Introduction to GitlabIntroduction to Gitlab
Introduction to Gitlab
 
Introduction to git flow
Introduction to git flowIntroduction to git flow
Introduction to git flow
 
Learning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdfLearning Git and GitHub - BIT GDSC.pdf
Learning Git and GitHub - BIT GDSC.pdf
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
 
Github
GithubGithub
Github
 
Advanced Git
Advanced GitAdvanced Git
Advanced Git
 
Getting started with GitHub Desktop
Getting started with GitHub DesktopGetting started with GitHub Desktop
Getting started with GitHub Desktop
 
Basic Git Intro
Basic Git IntroBasic Git Intro
Basic Git Intro
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Version control system
Version control systemVersion control system
Version control system
 
Scheduling in Android
Scheduling in AndroidScheduling in Android
Scheduling in Android
 
GitLab.pptx
GitLab.pptxGitLab.pptx
GitLab.pptx
 
Git Lab Introduction
Git Lab IntroductionGit Lab Introduction
Git Lab Introduction
 
Intro to Github Actions @likecoin
Intro to Github Actions @likecoinIntro to Github Actions @likecoin
Intro to Github Actions @likecoin
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 

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 Systemjamed749
 
(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 introductionKrishna-Kumar
 
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 ServicesAmazon Web Services
 
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 ServicesAmazon Web Services
 

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

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
 
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
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 

Recently uploaded

High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSsandhya757531
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catcherssdickerson1
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdfCaalaaAbdulkerim
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdfAkritiPradhan2
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Coursebim.edu.pl
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfisabel213075
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdfHafizMudaserAhmad
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Erbil Polytechnic University
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxRomil Mishra
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming languageSmritiSharma901052
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 

Recently uploaded (20)

High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMSHigh Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
High Voltage Engineering- OVER VOLTAGES IN ELECTRICAL POWER SYSTEMS
 
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor CatchersTechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
TechTAC® CFD Report Summary: A Comparison of Two Types of Tubing Anchor Catchers
 
Research Methodology for Engineering pdf
Research Methodology for Engineering pdfResearch Methodology for Engineering pdf
Research Methodology for Engineering pdf
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
Katarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School CourseKatarzyna Lipka-Sidor - BIM School Course
Katarzyna Lipka-Sidor - BIM School Course
 
List of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdfList of Accredited Concrete Batching Plant.pdf
List of Accredited Concrete Batching Plant.pdf
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf11. Properties of Liquid Fuels in Energy Engineering.pdf
11. Properties of Liquid Fuels in Energy Engineering.pdf
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
Comparative study of High-rise Building Using ETABS,SAP200 and SAFE., SAFE an...
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
Mine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptxMine Environment II Lab_MI10448MI__________.pptx
Mine Environment II Lab_MI10448MI__________.pptx
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
OOP concepts -in-Python programming language
OOP concepts -in-Python programming languageOOP concepts -in-Python programming language
OOP concepts -in-Python programming language
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 

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