SlideShare ist ein Scribd-Unternehmen logo
1 von 44
Downloaden Sie, um offline zu lesen
Getting Into Git
8/11/2012
Rick Umali
rickumali@gmail.com
@rickumali
http://tech.rickumali.com/
This presentation is on Google Drive at:
http://sn.im/git-talk-2012
There you can read the 'speaker notes' for this
presentation. You can also provide feedback at:
https://joind.in/6830
Questions I Plan to Answer
What is source control?
What is the big deal with Git?
Can you show me a little Git?
Commits. Branches. Merges. Remote repos.
What is Source Control?
Source code control is the most important
practice a coding professional can do.
A mechanism to track changes in source code.
Used for version history, auditing, and
recovery.
Revision Control Example: Wiki
Revision Control Example: Git
This is what we'll be trying.
Git
Git is an open source, distributed version
control system designed for speed and
efficiency.
● Freedom
● No "server" required
● Unique architecture
Installing Git
http://git-scm.com/book/en/Getting-Started-Installing-Git
The installation is very easy!
Warning: Command Line Ahead
Our Example: A Basic Drupal Module
Creating a "Repository"
Let's pretend we're developing a Drupal
module.
% cd web/sites/all/modules
% mkdir dumpstamp
% cd dumpstamp
% git init
"git init" creates the entire Git repository. No
server interaction required!
Committing Your First File
To 'commit' means 'to save the state' of your
work. You must first 'add' this change to the
'staging area'.
% vi README.txt
% git add README.txt
% git commit -m "First commit. README file."
Use 'git help' to learn all the switches. -m
stands for message.
Looking at the Repository History
% git log
Each 'commit' contains an ID, along with the
author information from earlier, and a time
stamp.
% gitk
GUI tools can help you visualize the 'repo.'
Adding More Files
% vi dumpstamp.info dumpstamp.module
% git status
% git add .
% git commit
This second commit saves the work of adding
two files by using 'git add .'.
The .module and .info files are the two
required files for every Drupal module.
Enabling Our Drupal Module
% drush pm-info dumpstamp
% drush pm-enable dumpstamp
Examining Changes to Files
% vi dumpstamp.module
% git status
% git diff
% git add dumpstamp.module
% git commit
% git log
The above is a typical 'workflow'.
Git offers suggestions and hints as you use it.
Doing More Changes
% vi dumpstamp.module
% git diff
% git commit -a
Or even:
% git commit -a -m "Commit message."
Another typical 'workflow'.
Looking at the Log Again
The history can be examined different ways.
% git log
% git log --format=short
% git log --format=oneline
% git log --oneline
Revisiting History
You can 'revisit' any point of your history.
% git checkout SHAID
Every commit is known by its SHA ID.
This is the first step in making a branch! (Use
git checkout master to revert.)
Branching and Merging Next, But...
What we have covered so far is probably 70-
80% of what you will do with git.
Adding and committing files are the heart of
git (and any version control system).
Git encourages experimentation, by making
branching very easy.
Branching
Branching: git branch
% git branch BRANCH SHA1
% git checkout BRANCH
Make some edits on a change below the
master, then commit.
git branch makes a branch from the branch
you're on (default branch is 'master').
Branching: Starting State
SHA 1Amaster
NOTE: 'master' is a branch that's created 'by default'.
Branching: Make Some Changes
SHA 1A
SHA 2Bmaster
git commit
Branching: Making a Branch
SHA 1A
SHA 2Bmaster
branch1
git branch "branch1" SHA1A
git checkout "branch1"
OR git checkout -b branch1 SHA1A
Branching: Changes on the Branch
SHA 1A
SHA 2Bmaster branch1SHA 3C
(Make changes in "branch1".)
git commit
Visualizing the Branches
Merging
Bringing two branches together.
First 'checkout' the branch you want to merge
into (typically master), then 'merge' the
branch.
% git checkout master
% git merge BRANCH
Merging: Starting State
SHA 1A
SHA 2Bmaster branch1SHA 3C
Merging: Two Steps
SHA 1A
SHA 2B
master
branch1SHA 3C
SHA 4D
git checkout master
git merge branch1
Merging: The Hard Part
Manual 'merging' may be required.
Visualizing the Merge
Whew!
Remote Branches
You can 'browse' public Git repositories for
code that you want to examine or use.
You can upload a local Git repository to a
public Git repository.
Common Public Git Repositories
Browsing and Grabbing Code
git clone git@github.com:rickumali/RickUmaliVanityWebsite.
git
Uploading Code (to Github)
Create a key pair on your machine.
Create a repository (on Github).
Add a 'remote' (via git remote add).
Upload your code (via git push).
Creating a Key Pair
Creating a Repository
Adding a Remote, then Upload
After An Upload (to Github)
git clone git@github.com:rickumali/DumpStamp.git
Next Steps
Install Git.
Commit your code changes frequently.
Log verbosely (in commit messages).
Experiment (branch) often.
Getting Into Git
Rick Umali
rickumali@gmail.com
@rickumali
http://tech.rickumali.com/
Thank you!
Resources
http://git-scm.org/
Both "Pro Git" book, and Git reference
http://gitref.org/
A "quicker" Git reference
http://www-cs-students.stanford.edu/~blynn/gitmagic/
"Friendlier" Git walk-through (git magic).
http://drupal.org/node/803746
A workflow for using Git with Drupal.
http://www.mail-archive.com/dri-devel@lists.
sourceforge.net/msg39091.html
Linus on "clean history."
Resources
http://www.youtube.com/watch?v=4XpnKHJAok8
Linus Torvalds (Git creator) (May '07)
http://www.youtube.com/watch?v=8dhZ9BXQgc4
Randal Schwartz (Perl expert and Git old-timer) (Oct
'07)
http://www.youtube.com/watch?v=ZDR433b0HJY
Scott Chacon (Pro Git author) (July '11)

Weitere ähnliche Inhalte

Was ist angesagt?

HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubGDSCIIITBbsr
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - GitCarlo Bernaschina
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & GitJason Byrne
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsMikhail Melnik
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubBigBlueHat
 
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
 
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-FlowMikhail Melnik
 
Git for Beginners
Git for BeginnersGit for Beginners
Git for BeginnersRick Umali
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflowsArthur Shvetsov
 

Was ist angesagt? (20)

Git github
Git githubGit github
Git github
 
HacktoberFest-Git&GitHub
HacktoberFest-Git&GitHubHacktoberFest-Git&GitHub
HacktoberFest-Git&GitHub
 
Version Control System - Git
Version Control System - GitVersion Control System - Git
Version Control System - Git
 
Version Control & Git
Version Control & GitVersion Control & Git
Version Control & Git
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and TagsGit Series. Episode 2. Merge, Upstream Commands and Tags
Git Series. Episode 2. Merge, Upstream Commands and Tags
 
The Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHubThe Basics of Open Source Collaboration With Git and GitHub
The Basics of Open Source Collaboration With Git and GitHub
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Git-r-Done
Git-r-DoneGit-r-Done
Git-r-Done
 
Git & Github
Git & GithubGit & Github
Git & Github
 
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
Introduction to gitIntroduction to git
Introduction to git
 
Git n git hub
Git n git hubGit n git hub
Git n git hub
 
Git 101
Git 101Git 101
Git 101
 
Git
GitGit
Git
 
Git in 10 minutes
Git in 10 minutesGit in 10 minutes
Git in 10 minutes
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
Git for Beginners
Git for BeginnersGit for Beginners
Git for Beginners
 
Git and GitHub workflows
Git and GitHub workflowsGit and GitHub workflows
Git and GitHub workflows
 
Git undo
Git undoGit undo
Git undo
 

Andere mochten auch

How to Communicate Like Their Favorite Nonprofit - LTA Rally, New Orleans
How to Communicate Like Their Favorite Nonprofit - LTA Rally, New OrleansHow to Communicate Like Their Favorite Nonprofit - LTA Rally, New Orleans
How to Communicate Like Their Favorite Nonprofit - LTA Rally, New OrleansKivi Leroux Miller
 
中国的互联网
中国的互联网中国的互联网
中国的互联网Liu Xing
 
Scuola Madre Teresa India
Scuola Madre Teresa IndiaScuola Madre Teresa India
Scuola Madre Teresa Indiamaurinbu
 
Social Media & Freelancers Seminar
Social Media & Freelancers SeminarSocial Media & Freelancers Seminar
Social Media & Freelancers SeminarShashi Bellamkonda
 
Living Lab research landscape
Living Lab research landscapeLiving Lab research landscape
Living Lab research landscapeMarco Ferruzca
 
Advanced Link Tactics and Offsite SEO
Advanced Link Tactics and Offsite SEOAdvanced Link Tactics and Offsite SEO
Advanced Link Tactics and Offsite SEOIan Lurie
 
Beau et quelle_musique!!!_(jmjp)
Beau et quelle_musique!!!_(jmjp)Beau et quelle_musique!!!_(jmjp)
Beau et quelle_musique!!!_(jmjp)amfelisa
 
No Bragging and Nothing Boring: 9 Effective Ways to Share Impact
No Bragging and Nothing Boring: 9 Effective Ways to Share ImpactNo Bragging and Nothing Boring: 9 Effective Ways to Share Impact
No Bragging and Nothing Boring: 9 Effective Ways to Share ImpactKivi Leroux Miller
 
Digital Marketing Trends (and Nonprofit Comm Trends in General) for BloomCon
Digital Marketing Trends (and Nonprofit Comm Trends in General) for BloomConDigital Marketing Trends (and Nonprofit Comm Trends in General) for BloomCon
Digital Marketing Trends (and Nonprofit Comm Trends in General) for BloomConKivi Leroux Miller
 
Saved (part 3)
Saved (part 3)Saved (part 3)
Saved (part 3)jzatko
 
Using Oral Recordings for Reflection in English (with video)
Using Oral Recordings for Reflection in English (with video)Using Oral Recordings for Reflection in English (with video)
Using Oral Recordings for Reflection in English (with video)Andrew McCarthy
 
Kent Beck Effective Design
Kent Beck Effective DesignKent Beck Effective Design
Kent Beck Effective Designdeimos
 
American Independent Writers Going Freelance Workshop Nov 7 2009
American Independent Writers   Going Freelance Workshop Nov 7 2009American Independent Writers   Going Freelance Workshop Nov 7 2009
American Independent Writers Going Freelance Workshop Nov 7 2009Shashi Bellamkonda
 
Can we measure Creativity, Design and Innovation? The case of México.
Can we measure Creativity, Design and Innovation? The case of México.Can we measure Creativity, Design and Innovation? The case of México.
Can we measure Creativity, Design and Innovation? The case of México.Marco Ferruzca
 
What Successful Nonprofits Get Right about Marketing and Fundraising
What Successful Nonprofits Get Right about Marketing and FundraisingWhat Successful Nonprofits Get Right about Marketing and Fundraising
What Successful Nonprofits Get Right about Marketing and FundraisingKivi Leroux Miller
 
Consture
ConstureConsture
Constureshrheng
 

Andere mochten auch (20)

How to Communicate Like Their Favorite Nonprofit - LTA Rally, New Orleans
How to Communicate Like Their Favorite Nonprofit - LTA Rally, New OrleansHow to Communicate Like Their Favorite Nonprofit - LTA Rally, New Orleans
How to Communicate Like Their Favorite Nonprofit - LTA Rally, New Orleans
 
中国的互联网
中国的互联网中国的互联网
中国的互联网
 
Marketing to the customers
Marketing to the customers Marketing to the customers
Marketing to the customers
 
Scuola Madre Teresa India
Scuola Madre Teresa IndiaScuola Madre Teresa India
Scuola Madre Teresa India
 
Social Media & Freelancers Seminar
Social Media & Freelancers SeminarSocial Media & Freelancers Seminar
Social Media & Freelancers Seminar
 
Living Lab research landscape
Living Lab research landscapeLiving Lab research landscape
Living Lab research landscape
 
Reclame
ReclameReclame
Reclame
 
Advanced Link Tactics and Offsite SEO
Advanced Link Tactics and Offsite SEOAdvanced Link Tactics and Offsite SEO
Advanced Link Tactics and Offsite SEO
 
Beau et quelle_musique!!!_(jmjp)
Beau et quelle_musique!!!_(jmjp)Beau et quelle_musique!!!_(jmjp)
Beau et quelle_musique!!!_(jmjp)
 
No Bragging and Nothing Boring: 9 Effective Ways to Share Impact
No Bragging and Nothing Boring: 9 Effective Ways to Share ImpactNo Bragging and Nothing Boring: 9 Effective Ways to Share Impact
No Bragging and Nothing Boring: 9 Effective Ways to Share Impact
 
Digital Marketing Trends (and Nonprofit Comm Trends in General) for BloomCon
Digital Marketing Trends (and Nonprofit Comm Trends in General) for BloomConDigital Marketing Trends (and Nonprofit Comm Trends in General) for BloomCon
Digital Marketing Trends (and Nonprofit Comm Trends in General) for BloomCon
 
Saved (part 3)
Saved (part 3)Saved (part 3)
Saved (part 3)
 
Using Oral Recordings for Reflection in English (with video)
Using Oral Recordings for Reflection in English (with video)Using Oral Recordings for Reflection in English (with video)
Using Oral Recordings for Reflection in English (with video)
 
Lucy Copia
Lucy   CopiaLucy   Copia
Lucy Copia
 
Kent Beck Effective Design
Kent Beck Effective DesignKent Beck Effective Design
Kent Beck Effective Design
 
Imagenes navidad
Imagenes navidadImagenes navidad
Imagenes navidad
 
American Independent Writers Going Freelance Workshop Nov 7 2009
American Independent Writers   Going Freelance Workshop Nov 7 2009American Independent Writers   Going Freelance Workshop Nov 7 2009
American Independent Writers Going Freelance Workshop Nov 7 2009
 
Can we measure Creativity, Design and Innovation? The case of México.
Can we measure Creativity, Design and Innovation? The case of México.Can we measure Creativity, Design and Innovation? The case of México.
Can we measure Creativity, Design and Innovation? The case of México.
 
What Successful Nonprofits Get Right about Marketing and Fundraising
What Successful Nonprofits Get Right about Marketing and FundraisingWhat Successful Nonprofits Get Right about Marketing and Fundraising
What Successful Nonprofits Get Right about Marketing and Fundraising
 
Consture
ConstureConsture
Consture
 

Ähnlich wie Getting Into Git

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
 
Git tutorial
Git tutorialGit tutorial
Git tutorialmobaires
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | WorkshopAnuchit Chalothorn
 
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
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshopthemystic_ca
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfmurad khan
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptuallyseungzzang Kim
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubDSC GVP
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced gitGerrit Wanderer
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdfAliaaTarek5
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticlePRIYATHAMDARISI
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for ArtistsDavid Newbury
 

Ähnlich wie Getting Into Git (20)

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 tutorial
Git tutorialGit tutorial
Git tutorial
 
Collaborative development with Git | Workshop
Collaborative development with Git | WorkshopCollaborative development with Git | Workshop
Collaborative development with Git | Workshop
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
Introduction To Git Workshop
Introduction To Git WorkshopIntroduction To Git Workshop
Introduction To Git Workshop
 
git-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdfgit-commands-cheat-sheet-infopediya-com.pdf
git-commands-cheat-sheet-infopediya-com.pdf
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git and Github workshop
Git and Github workshopGit and Github workshop
Git and Github workshop
 
Pro git - grasping it conceptually
Pro git - grasping it conceptuallyPro git - grasping it conceptually
Pro git - grasping it conceptually
 
Hacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHubHacktoberfest intro to Git and GitHub
Hacktoberfest intro to Git and GitHub
 
git2.ppt
git2.pptgit2.ppt
git2.ppt
 
Use Git like a pro - condensed
Use Git like a pro - condensedUse Git like a pro - condensed
Use Git like a pro - condensed
 
Checkitmobile advanced git
Checkitmobile advanced gitCheckitmobile advanced git
Checkitmobile advanced git
 
Git tips
Git tipsGit tips
Git tips
 
Git_tutorial.pdf
Git_tutorial.pdfGit_tutorial.pdf
Git_tutorial.pdf
 
Git introduction
Git introductionGit introduction
Git introduction
 
Introduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech ArticleIntroduction to GitHub, Open Source and Tech Article
Introduction to GitHub, Open Source and Tech Article
 
Git and Version Control at Atlogys
Git and Version Control at AtlogysGit and Version Control at Atlogys
Git and Version Control at Atlogys
 
Introduction to Git for Artists
Introduction to Git for ArtistsIntroduction to Git for Artists
Introduction to Git for Artists
 
1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx1-Intro to VC & GIT PDF.pptx
1-Intro to VC & GIT PDF.pptx
 

Kürzlich hochgeladen

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 

Kürzlich hochgeladen (20)

Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Getting Into Git

  • 1. Getting Into Git 8/11/2012 Rick Umali rickumali@gmail.com @rickumali http://tech.rickumali.com/ This presentation is on Google Drive at: http://sn.im/git-talk-2012 There you can read the 'speaker notes' for this presentation. You can also provide feedback at: https://joind.in/6830
  • 2. Questions I Plan to Answer What is source control? What is the big deal with Git? Can you show me a little Git? Commits. Branches. Merges. Remote repos.
  • 3. What is Source Control? Source code control is the most important practice a coding professional can do. A mechanism to track changes in source code. Used for version history, auditing, and recovery.
  • 5. Revision Control Example: Git This is what we'll be trying.
  • 6. Git Git is an open source, distributed version control system designed for speed and efficiency. ● Freedom ● No "server" required ● Unique architecture
  • 9. Our Example: A Basic Drupal Module
  • 10. Creating a "Repository" Let's pretend we're developing a Drupal module. % cd web/sites/all/modules % mkdir dumpstamp % cd dumpstamp % git init "git init" creates the entire Git repository. No server interaction required!
  • 11. Committing Your First File To 'commit' means 'to save the state' of your work. You must first 'add' this change to the 'staging area'. % vi README.txt % git add README.txt % git commit -m "First commit. README file." Use 'git help' to learn all the switches. -m stands for message.
  • 12. Looking at the Repository History % git log Each 'commit' contains an ID, along with the author information from earlier, and a time stamp. % gitk GUI tools can help you visualize the 'repo.'
  • 13. Adding More Files % vi dumpstamp.info dumpstamp.module % git status % git add . % git commit This second commit saves the work of adding two files by using 'git add .'. The .module and .info files are the two required files for every Drupal module.
  • 14. Enabling Our Drupal Module % drush pm-info dumpstamp % drush pm-enable dumpstamp
  • 15. Examining Changes to Files % vi dumpstamp.module % git status % git diff % git add dumpstamp.module % git commit % git log The above is a typical 'workflow'. Git offers suggestions and hints as you use it.
  • 16. Doing More Changes % vi dumpstamp.module % git diff % git commit -a Or even: % git commit -a -m "Commit message." Another typical 'workflow'.
  • 17. Looking at the Log Again The history can be examined different ways. % git log % git log --format=short % git log --format=oneline % git log --oneline
  • 18. Revisiting History You can 'revisit' any point of your history. % git checkout SHAID Every commit is known by its SHA ID. This is the first step in making a branch! (Use git checkout master to revert.)
  • 19. Branching and Merging Next, But... What we have covered so far is probably 70- 80% of what you will do with git. Adding and committing files are the heart of git (and any version control system).
  • 20. Git encourages experimentation, by making branching very easy. Branching
  • 21. Branching: git branch % git branch BRANCH SHA1 % git checkout BRANCH Make some edits on a change below the master, then commit. git branch makes a branch from the branch you're on (default branch is 'master').
  • 22. Branching: Starting State SHA 1Amaster NOTE: 'master' is a branch that's created 'by default'.
  • 23. Branching: Make Some Changes SHA 1A SHA 2Bmaster git commit
  • 24. Branching: Making a Branch SHA 1A SHA 2Bmaster branch1 git branch "branch1" SHA1A git checkout "branch1" OR git checkout -b branch1 SHA1A
  • 25. Branching: Changes on the Branch SHA 1A SHA 2Bmaster branch1SHA 3C (Make changes in "branch1".) git commit
  • 27. Merging Bringing two branches together. First 'checkout' the branch you want to merge into (typically master), then 'merge' the branch. % git checkout master % git merge BRANCH
  • 28. Merging: Starting State SHA 1A SHA 2Bmaster branch1SHA 3C
  • 29. Merging: Two Steps SHA 1A SHA 2B master branch1SHA 3C SHA 4D git checkout master git merge branch1
  • 30. Merging: The Hard Part Manual 'merging' may be required.
  • 32. Whew!
  • 33. Remote Branches You can 'browse' public Git repositories for code that you want to examine or use. You can upload a local Git repository to a public Git repository.
  • 34. Common Public Git Repositories
  • 35. Browsing and Grabbing Code git clone git@github.com:rickumali/RickUmaliVanityWebsite. git
  • 36. Uploading Code (to Github) Create a key pair on your machine. Create a repository (on Github). Add a 'remote' (via git remote add). Upload your code (via git push).
  • 39. Adding a Remote, then Upload
  • 40. After An Upload (to Github) git clone git@github.com:rickumali/DumpStamp.git
  • 41. Next Steps Install Git. Commit your code changes frequently. Log verbosely (in commit messages). Experiment (branch) often.
  • 42. Getting Into Git Rick Umali rickumali@gmail.com @rickumali http://tech.rickumali.com/ Thank you!
  • 43. Resources http://git-scm.org/ Both "Pro Git" book, and Git reference http://gitref.org/ A "quicker" Git reference http://www-cs-students.stanford.edu/~blynn/gitmagic/ "Friendlier" Git walk-through (git magic). http://drupal.org/node/803746 A workflow for using Git with Drupal. http://www.mail-archive.com/dri-devel@lists. sourceforge.net/msg39091.html Linus on "clean history."
  • 44. Resources http://www.youtube.com/watch?v=4XpnKHJAok8 Linus Torvalds (Git creator) (May '07) http://www.youtube.com/watch?v=8dhZ9BXQgc4 Randal Schwartz (Perl expert and Git old-timer) (Oct '07) http://www.youtube.com/watch?v=ZDR433b0HJY Scott Chacon (Pro Git author) (July '11)