SlideShare une entreprise Scribd logo
1  sur  64
Introduction To Git Workshop
Tom Aratyn
Get Git
• On Matrix
•

I have accounts for you

• On Windows
•

http://msysgit.github.io

• On OS X
•

brew install git

• On Linux
•

sudo apt-get install git

• Otherwise
•

http://git-scm.com
About Me
Django and JavaScript Developer
Founder @ The Boulevard Platform
Engineer @ FoxyProxy
Created open source projects:
BitBucket Release Note Generator
django-email-changer
Exploit Me Suite
Why Git?
Git is
•
•
•
•
•

Small
Fast
Distributed
Free & Open Source
Trusted
•
•
•

Linux
Homebrew
Everyone on GitHub + Gitorious +
Not Just For Code
(but mainly for code)
http://government.github.com
About Today
What we will cover
• Creating Repos
• Checking Out
• Committing
• Basic Branching
• Basic Merging
• Pushing & Pulling

What we won't
• git reset
• Changing history

• Rebasing
• Adding/Removing
Remotes
• Partial Staging
• Fetch
• Tags
Making A Git Repository
Normal Repository
Bare Repository
Cloned Repository
A git repository with a working directory

Normal Repository
Normal Repository Exercise
$ git init workshop.normal.git
A git repo without a working directory
(this is what you want on the repo)

Bare Repository
Bare Repository Exercise
$ git init --bare workshop.bare.git
Cloned Repository
A normal repository is a copy of a remote repository and setup to
work with it.
Cloned Repository Exercise
$ git clone workshop.bare.git
workshop.git
$ cd workshop.git
Image By: Scott Chacon, Pro Git
Staging Files
Before a file can be added it must
be staged
Staging File Exercise
$ mvim index.html
$ git add index.html
What’s The Status Of My Files
Right Now?
$ git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
#
(use "git rm --cached <file>..." to
unstage)
#
# new file:
index.html
#
Committing Files
Committing means that we want in the
version control system.
All staged files will be committed.
Commit File Exercise
$ git commit –m "My initial commit"
Commit File Exercise Result
Committer: Tom Aratyn <mystic@nelson.local>
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
1 file changed, 0 insertions(+), 0 deletions(-)
create mode 100644 foo
The Log
Git keeps a log of everything you commit,
who wrote authored it, and who committed
it.
View The Git Log Exercise
$ git log
$ git log --graph
$ gitk
(Don’t worry there are better
GUIs, more on that later)
Why isn't your name there?
The Parts Of A Log
List of commits and branch pointers
A commit is made up of:
•
•
•
•
•

SHA1 id
Message
Files
Author
Committer
Configuring git
git is configured in two places:
~/.gitconfig
youreRepo/.git/config
Configuring Git Exercise
$ git config --global user.name
"Your Name"
$ git config --global user.email
you@example.com
Configuring Git Exercise Result
$ cat ~/.gitconfig
[user]
name = Tom Aratyn
email = "tom@aratyn.name"
Changing History
There are many ways to change history in
git.
We're only going to look at one way:
Amend the last commit.
Change The Last Commit Exercise
$ git commit --amend -m "initial
commit with an html file"
$ # has the author changed?
$ gitk
Author Vs. Committer
Git is made from from the ground up for
multiple developer projects (Linux).
Large projects often distinguish between the
author (who wrote the patch/code) and the
committer (who let it into the blessed
repository)
Update the Author Exercise
$ git commit --amend --resetauthor
# why did the screen change ?
# type in ":wq" to leave vim.
How To Remove A File?
What if we committed a file we no longer
need can we get rid of it?
Yes & No
From the current (and future) versions.

Yes, You Can Remove It
No, It'll Be In Past Versions
The whole point of version control is you can always recover old
files.
Remove A File Exercise
$ git rm index.html
$ ls
$ #Notice how the file is now gone
$ git status
$ #Notice how the file is staged
$ git commit -m "Removed
index.html"
Create another index.html and commit it

Practice: Adding a file
Branching
Fast and easy branching is git's killer
feature.
Branches let development progress on
multiple fronts separately and
simultaneously.
Check Your Branch Exercise
$ git branch
$ git branch –a
$ # What's the difference between
the two commands?
Create A Branch Exercise
$ git branch workshop-example
$ git branch
$ # what branch are you on?
Switch Branch Exercise
$ git checkout workshop-example
$ git branch
$ # now what branch are you on?
Switch To A New Branch
Immediately Exercise
$ git checkout -b fix-bug-123
$ git branch
$ gitk
Making A Change On A Branch
Exercise
$ # edit index.html
$ git add index.html
$ git commit -m "Added some initial
html"
Merging
Merging is really git's killer feature
Because branching without merging is pretty
useless
See CVS
Merging Process
1. Go to the branch you want to merge into
• Often the branch you branched off of.
• Usually "master" or "develop"

2. Do the merge
Two Three types of merges
1. Fast Forward Merge
2. Basic Merge
a. Conflicted Merge
Only available when the branch can be cleanly applied onto your
current branch

Fast Forward Merge
Fast Forward Merge Exercise
$ # (assuming you have a change on
fix-bug-123 - use gitk to check)
$ git checkout master
$ git merge fix-bug-123
$ gitk
Basic Merge Exercise
Prep
Add add a div on the master
branch
Change the title on the fixbug-123 branch

Recall
git checkout
git add
git commit
Basic Merge Exercise
$ git checkout master
$ git merge fix-bug-123
$ git log --graph --decorate --all
Conflicted Merge Exercise
Prep
Change the same line on
both branches
(change the class on the
same div)

Recall
git checkout
git add
git commit
Conflicted Merge Exercise
$
$
$
$
$
$
$

git checkout master
git merge fix-bug-123
git status
# edit index.html
git add index.html
git commit
git log --graph --decorate --all
Sharing Is Caring
So far everything we've done is on the same
repo but projects need to be shared.
Git lets you push your changes to others
and pull the changes others made.
Pushing Exercise
$ # Recall that we cloned our bare
repo
$ git push origin master
$ cd ../workshop.bare.git
$ git log
Pulling Exercise
Prep
1. Clone the bare repo
again
•

Call it workshop.2.git

2. Commit a change to
workshop.git
3. Push the change

Recall
git clone
git add
git commit
git push
Pulling Exercise
$
$
$
$

cd ../workshop.2.git
git branch
git pull
git log
How does pulling work?
Tracking Branches
A tracking branch is a local branch which
knows that updates to a remote branch
should be applied to it.
Tracking Branch Exercise
$ git checkout –t
remotes/origin/fix-bug-123
About Today
What we covered
• Creating Repos
• Checking Out
• Committing
• Basic Branching
• Basic Merging
• Pushing & Pulling

What we didn't
• git reset
• Changing history

• Rebasing
• Adding/Removing
Remotes
• Partial Staging
Where to next?
Learn more at from "Pro Git"
http://git-scm.com/book

Start Your Project:
Free Open Source Repos
http://github.com

Free Private Repos
http://bitbucket.org

GUI: http://SourceTreeApp.com
Questions?
A link to this presentation will be on
http://blog.tom.aratyn.name
@themystic
tom@aratyn.name (I can email it to you)

Thank You!

Contenu connexe

Tendances

GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control SystemMohammad Imam Hossain
 
My Notes from https://www.codeschool.com/courses/git-real
My Notes from  https://www.codeschool.com/courses/git-realMy Notes from  https://www.codeschool.com/courses/git-real
My Notes from https://www.codeschool.com/courses/git-realEneldo Serrata
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and githubAderemi Dadepo
 
Github - Le Wagon Melbourne
Github - Le Wagon MelbourneGithub - Le Wagon Melbourne
Github - Le Wagon MelbournePaal Ringstad
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control SystemKMS Technology
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use ItDaniel Kummer
 
Git Basics - RubyFest 2009
Git Basics - RubyFest 2009Git Basics - RubyFest 2009
Git Basics - RubyFest 2009Ariejan de Vroom
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperJohn Stevenson
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginnersbryanbibat
 
Deep dark-side of git: How git works internally
Deep dark-side of git: How git works internallyDeep dark-side of git: How git works internally
Deep dark-side of git: How git works internallySeongJae Park
 
Git: from Novice to Expert
Git: from Novice to ExpertGit: from Novice to Expert
Git: from Novice to ExpertGoddy Zhao
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and GithubHouari ZEGAI
 
Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails UndergroundAriejan de Vroom
 

Tendances (20)

Github
GithubGithub
Github
 
GIT | Distributed Version Control System
GIT | Distributed Version Control SystemGIT | Distributed Version Control System
GIT | Distributed Version Control System
 
My Notes from https://www.codeschool.com/courses/git-real
My Notes from  https://www.codeschool.com/courses/git-realMy Notes from  https://www.codeschool.com/courses/git-real
My Notes from https://www.codeschool.com/courses/git-real
 
Intro to Git and GitHub
Intro to Git and GitHubIntro to Git and GitHub
Intro to Git and GitHub
 
Introduction to git and github
Introduction to git and githubIntroduction to git and github
Introduction to git and github
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git commands
Git commandsGit commands
Git commands
 
Github - Le Wagon Melbourne
Github - Le Wagon MelbourneGithub - Le Wagon Melbourne
Github - Le Wagon Melbourne
 
Git Version Control System
Git Version Control SystemGit Version Control System
Git Version Control System
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
 
Git Basics - RubyFest 2009
Git Basics - RubyFest 2009Git Basics - RubyFest 2009
Git Basics - RubyFest 2009
 
Git advanced
Git advancedGit advanced
Git advanced
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
Git & GitHub WorkShop
Git & GitHub WorkShopGit & GitHub WorkShop
Git & GitHub WorkShop
 
Version Control with Git for Beginners
Version Control with Git for BeginnersVersion Control with Git for Beginners
Version Control with Git for Beginners
 
Deep dark-side of git: How git works internally
Deep dark-side of git: How git works internallyDeep dark-side of git: How git works internally
Deep dark-side of git: How git works internally
 
Git: from Novice to Expert
Git: from Novice to ExpertGit: from Novice to Expert
Git: from Novice to Expert
 
Introduction to Git and Github
Introduction to Git and GithubIntroduction to Git and Github
Introduction to Git and Github
 
Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015Nina Zakharenko - Introduction to Git - Start SLC 2015
Nina Zakharenko - Introduction to Git - Start SLC 2015
 
Git Basics at Rails Underground
Git Basics at Rails UndergroundGit Basics at Rails Underground
Git Basics at Rails Underground
 

En vedette

component based softwrae engineering Cbse
component based softwrae engineering Cbsecomponent based softwrae engineering Cbse
component based softwrae engineering CbseSravs Dals
 
Docker & PHP - Practical use case
Docker & PHP - Practical use caseDocker & PHP - Practical use case
Docker & PHP - Practical use caserjsmelo
 
Docker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopDocker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopChris Tankersley
 
Microservices without Servers
Microservices without ServersMicroservices without Servers
Microservices without ServersDev_Events
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting StartedWildan Maulana
 
Computer-free Website Development Demo - WordPressDC Jan 2015
 Computer-free Website Development Demo - WordPressDC Jan 2015 Computer-free Website Development Demo - WordPressDC Jan 2015
Computer-free Website Development Demo - WordPressDC Jan 2015Anthony D. Paul
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Chris Tankersley
 
Information Design Web Planning Mockup
Information Design Web Planning MockupInformation Design Web Planning Mockup
Information Design Web Planning MockupANGELA Smithers
 
NTR Lab - bespoke software development in Russia
NTR Lab - bespoke software development in RussiaNTR Lab - bespoke software development in Russia
NTR Lab - bespoke software development in RussiaOlessya
 
2013 Social Admissions Report
 2013 Social Admissions Report   2013 Social Admissions Report
2013 Social Admissions Report Uversity, Inc.
 
Php development with Docker
Php development with DockerPhp development with Docker
Php development with DockerMichael Bui
 
Engine lab software hybrid cloud specialists
Engine lab software hybrid cloud specialistsEngine lab software hybrid cloud specialists
Engine lab software hybrid cloud specialistsJohn Rowan
 
The App Evolution
The App Evolution The App Evolution
The App Evolution Dev_Events
 
An introduction to contianers and Docker for PHP developers
An introduction to contianers and Docker for PHP developersAn introduction to contianers and Docker for PHP developers
An introduction to contianers and Docker for PHP developersRobert McFrazier
 
Building Next Generation Applications and Microservices
Building Next Generation Applications and Microservices Building Next Generation Applications and Microservices
Building Next Generation Applications and Microservices Dev_Events
 
Trabalhando em ambientes php com docker
Trabalhando em ambientes php com dockerTrabalhando em ambientes php com docker
Trabalhando em ambientes php com dockerAlef Castelo
 

En vedette (20)

Especialidade de inclusão 5
Especialidade de inclusão 5Especialidade de inclusão 5
Especialidade de inclusão 5
 
component based softwrae engineering Cbse
component based softwrae engineering Cbsecomponent based softwrae engineering Cbse
component based softwrae engineering Cbse
 
MockupBuilder
MockupBuilderMockupBuilder
MockupBuilder
 
Docker & PHP - Practical use case
Docker & PHP - Practical use caseDocker & PHP - Practical use case
Docker & PHP - Practical use case
 
Docker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 WorkshopDocker for Developers - PNWPHP 2016 Workshop
Docker for Developers - PNWPHP 2016 Workshop
 
Microservices without Servers
Microservices without ServersMicroservices without Servers
Microservices without Servers
 
Spm file33
Spm file33Spm file33
Spm file33
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 
Computer-free Website Development Demo - WordPressDC Jan 2015
 Computer-free Website Development Demo - WordPressDC Jan 2015 Computer-free Website Development Demo - WordPressDC Jan 2015
Computer-free Website Development Demo - WordPressDC Jan 2015
 
Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016Docker for PHP Developers - ZendCon 2016
Docker for PHP Developers - ZendCon 2016
 
Information Design Web Planning Mockup
Information Design Web Planning MockupInformation Design Web Planning Mockup
Information Design Web Planning Mockup
 
NTR Lab - bespoke software development in Russia
NTR Lab - bespoke software development in RussiaNTR Lab - bespoke software development in Russia
NTR Lab - bespoke software development in Russia
 
2013 Social Admissions Report
 2013 Social Admissions Report   2013 Social Admissions Report
2013 Social Admissions Report
 
Php development with Docker
Php development with DockerPhp development with Docker
Php development with Docker
 
Engine lab software hybrid cloud specialists
Engine lab software hybrid cloud specialistsEngine lab software hybrid cloud specialists
Engine lab software hybrid cloud specialists
 
The App Evolution
The App Evolution The App Evolution
The App Evolution
 
An introduction to contianers and Docker for PHP developers
An introduction to contianers and Docker for PHP developersAn introduction to contianers and Docker for PHP developers
An introduction to contianers and Docker for PHP developers
 
Lab docker
Lab dockerLab docker
Lab docker
 
Building Next Generation Applications and Microservices
Building Next Generation Applications and Microservices Building Next Generation Applications and Microservices
Building Next Generation Applications and Microservices
 
Trabalhando em ambientes php com docker
Trabalhando em ambientes php com dockerTrabalhando em ambientes php com docker
Trabalhando em ambientes php com docker
 

Similaire à Introduction To Git Workshop

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
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
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | WorkshopAnuchit Chalothorn
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.comdropsolid
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Ashok Kumar
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?9 series
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptuallyseungzzang Kim
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierChristoph Matthies
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github Max Claus Nunes
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get GitSusan Tan
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmdsrinathcox
 
Git Memento of basic commands
Git Memento of basic commandsGit Memento of basic commands
Git Memento of basic commandsZakaria Bouazza
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 

Similaire à Introduction To Git Workshop (20)

Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
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
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Git session Dropsolid.com
Git session Dropsolid.comGit session Dropsolid.com
Git session Dropsolid.com
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)Git Ninja KT (GitHub to GitLab)
Git Ninja KT (GitHub to GitLab)
 
Git training v10
Git training v10Git training v10
Git training v10
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Introduction to Git and Github
Introduction to Git and Github Introduction to Git and Github
Introduction to Git and Github
 
390a gitintro 12au
390a gitintro 12au390a gitintro 12au
390a gitintro 12au
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get Git
 
Learning Basic GIT Cmd
Learning Basic GIT CmdLearning Basic GIT Cmd
Learning Basic GIT Cmd
 
Git Memento of basic commands
Git Memento of basic commandsGit Memento of basic commands
Git Memento of basic commands
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
GIT_In_90_Minutes
GIT_In_90_MinutesGIT_In_90_Minutes
GIT_In_90_Minutes
 
Git and github 101
Git and github 101Git and github 101
Git and github 101
 
sample.pptx
sample.pptxsample.pptx
sample.pptx
 

Dernier

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 

Dernier (20)

Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 

Introduction To Git Workshop

  • 1. Introduction To Git Workshop Tom Aratyn
  • 2. Get Git • On Matrix • I have accounts for you • On Windows • http://msysgit.github.io • On OS X • brew install git • On Linux • sudo apt-get install git • Otherwise • http://git-scm.com
  • 3. About Me Django and JavaScript Developer Founder @ The Boulevard Platform Engineer @ FoxyProxy Created open source projects: BitBucket Release Note Generator django-email-changer Exploit Me Suite
  • 4. Why Git? Git is • • • • • Small Fast Distributed Free & Open Source Trusted • • • Linux Homebrew Everyone on GitHub + Gitorious +
  • 5. Not Just For Code (but mainly for code) http://government.github.com
  • 6.
  • 7. About Today What we will cover • Creating Repos • Checking Out • Committing • Basic Branching • Basic Merging • Pushing & Pulling What we won't • git reset • Changing history • Rebasing • Adding/Removing Remotes • Partial Staging • Fetch • Tags
  • 8. Making A Git Repository Normal Repository Bare Repository Cloned Repository
  • 9. A git repository with a working directory Normal Repository
  • 10. Normal Repository Exercise $ git init workshop.normal.git
  • 11. A git repo without a working directory (this is what you want on the repo) Bare Repository
  • 12. Bare Repository Exercise $ git init --bare workshop.bare.git
  • 13. Cloned Repository A normal repository is a copy of a remote repository and setup to work with it.
  • 14. Cloned Repository Exercise $ git clone workshop.bare.git workshop.git $ cd workshop.git
  • 15. Image By: Scott Chacon, Pro Git
  • 16. Staging Files Before a file can be added it must be staged
  • 17. Staging File Exercise $ mvim index.html $ git add index.html
  • 18. What’s The Status Of My Files Right Now? $ git status # On branch master # # Initial commit # # Changes to be committed: # (use "git rm --cached <file>..." to unstage) # # new file: index.html #
  • 19. Committing Files Committing means that we want in the version control system. All staged files will be committed.
  • 20. Commit File Exercise $ git commit –m "My initial commit"
  • 21. Commit File Exercise Result Committer: Tom Aratyn <mystic@nelson.local> Your name and email address were configured automatically based on your username and hostname. Please check that they are accurate. You can suppress this message by setting them explicitly: git config --global user.name "Your Name" git config --global user.email you@example.com After doing this, you may fix the identity used for this commit with: git commit --amend --reset-author 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 foo
  • 22. The Log Git keeps a log of everything you commit, who wrote authored it, and who committed it.
  • 23. View The Git Log Exercise $ git log $ git log --graph $ gitk
  • 24. (Don’t worry there are better GUIs, more on that later)
  • 25. Why isn't your name there?
  • 26. The Parts Of A Log List of commits and branch pointers A commit is made up of: • • • • • SHA1 id Message Files Author Committer
  • 27. Configuring git git is configured in two places: ~/.gitconfig youreRepo/.git/config
  • 28. Configuring Git Exercise $ git config --global user.name "Your Name" $ git config --global user.email you@example.com
  • 29. Configuring Git Exercise Result $ cat ~/.gitconfig [user] name = Tom Aratyn email = "tom@aratyn.name"
  • 30. Changing History There are many ways to change history in git. We're only going to look at one way: Amend the last commit.
  • 31. Change The Last Commit Exercise $ git commit --amend -m "initial commit with an html file" $ # has the author changed? $ gitk
  • 32. Author Vs. Committer Git is made from from the ground up for multiple developer projects (Linux). Large projects often distinguish between the author (who wrote the patch/code) and the committer (who let it into the blessed repository)
  • 33. Update the Author Exercise $ git commit --amend --resetauthor # why did the screen change ? # type in ":wq" to leave vim.
  • 34. How To Remove A File? What if we committed a file we no longer need can we get rid of it? Yes & No
  • 35. From the current (and future) versions. Yes, You Can Remove It
  • 36. No, It'll Be In Past Versions The whole point of version control is you can always recover old files.
  • 37. Remove A File Exercise $ git rm index.html $ ls $ #Notice how the file is now gone $ git status $ #Notice how the file is staged $ git commit -m "Removed index.html"
  • 38. Create another index.html and commit it Practice: Adding a file
  • 39. Branching Fast and easy branching is git's killer feature. Branches let development progress on multiple fronts separately and simultaneously.
  • 40. Check Your Branch Exercise $ git branch $ git branch –a $ # What's the difference between the two commands?
  • 41. Create A Branch Exercise $ git branch workshop-example $ git branch $ # what branch are you on?
  • 42. Switch Branch Exercise $ git checkout workshop-example $ git branch $ # now what branch are you on?
  • 43. Switch To A New Branch Immediately Exercise $ git checkout -b fix-bug-123 $ git branch $ gitk
  • 44. Making A Change On A Branch Exercise $ # edit index.html $ git add index.html $ git commit -m "Added some initial html"
  • 45. Merging Merging is really git's killer feature Because branching without merging is pretty useless See CVS
  • 46. Merging Process 1. Go to the branch you want to merge into • Often the branch you branched off of. • Usually "master" or "develop" 2. Do the merge
  • 47. Two Three types of merges 1. Fast Forward Merge 2. Basic Merge a. Conflicted Merge
  • 48. Only available when the branch can be cleanly applied onto your current branch Fast Forward Merge
  • 49. Fast Forward Merge Exercise $ # (assuming you have a change on fix-bug-123 - use gitk to check) $ git checkout master $ git merge fix-bug-123 $ gitk
  • 50. Basic Merge Exercise Prep Add add a div on the master branch Change the title on the fixbug-123 branch Recall git checkout git add git commit
  • 51. Basic Merge Exercise $ git checkout master $ git merge fix-bug-123 $ git log --graph --decorate --all
  • 52. Conflicted Merge Exercise Prep Change the same line on both branches (change the class on the same div) Recall git checkout git add git commit
  • 53. Conflicted Merge Exercise $ $ $ $ $ $ $ git checkout master git merge fix-bug-123 git status # edit index.html git add index.html git commit git log --graph --decorate --all
  • 54. Sharing Is Caring So far everything we've done is on the same repo but projects need to be shared. Git lets you push your changes to others and pull the changes others made.
  • 55. Pushing Exercise $ # Recall that we cloned our bare repo $ git push origin master $ cd ../workshop.bare.git $ git log
  • 56. Pulling Exercise Prep 1. Clone the bare repo again • Call it workshop.2.git 2. Commit a change to workshop.git 3. Push the change Recall git clone git add git commit git push
  • 59. Tracking Branches A tracking branch is a local branch which knows that updates to a remote branch should be applied to it.
  • 60. Tracking Branch Exercise $ git checkout –t remotes/origin/fix-bug-123
  • 61. About Today What we covered • Creating Repos • Checking Out • Committing • Basic Branching • Basic Merging • Pushing & Pulling What we didn't • git reset • Changing history • Rebasing • Adding/Removing Remotes • Partial Staging
  • 62. Where to next? Learn more at from "Pro Git" http://git-scm.com/book Start Your Project: Free Open Source Repos http://github.com Free Private Repos http://bitbucket.org GUI: http://SourceTreeApp.com
  • 64. A link to this presentation will be on http://blog.tom.aratyn.name @themystic tom@aratyn.name (I can email it to you) Thank You!