SlideShare uma empresa Scribd logo
1 de 45
GIT BASICS
by Ariejan de Vroom – Kabisa ICT
WHAT THE GIT?!

“I'm an egotistical bastard, and I name all my projects after
       myself. First Linux, now git.” – Linus Torvalds
GET GIT!
http://git-scm.com/
SURVEY

• Who is NOT using version control?
• SubVersion?
• Anything else?
WHY GIT?!
• Distributed Repositories
• Non-linear Development
• Very fast branching and merging
• Toolkit Design
• Scales
• Cryptographic authentication of history.
LET’S ROCK!

~/gitbasics $ git init
Initialized empty Git repository
in /Users/ariejan/gitbasics/.git/
LET’S ROLL!

~/gitbasics $ git clone
git@github.com/ariejan/gitbasics.git
~/gitbasics $ echo quot;Live long and prosperquot; > README
~/gitbasics $ git add README
~/gitbasics $ git commit -m quot;Added READMEquot;
[master (root-commit)]: created 8e60b09: quot;Added READMEquot;
 1 files changed, 1 insertions(+), 0 deletions(-)
 create mode 100644 README
WHAT JUST HAPPENED?

~/gitbasics $ git log

commit 8e60b09d3082e9473944075cc01b3b67bb97d5c3
Author: Ariejan de Vroom <ariejan@ariejan.net>
Date: Mon May 11 21:51:24 2009 +0200

  Added README
HOW GIT WORKS
    Working Directory

              git add


      Staging Area

              git commit


      Repository
WORKFLOW

• Hack! ( TextMate, vim, ... )
• Stage your changes ( git add )
• Review your changes ( git status | diff )
• Commit (locally) ( git commit )
• Repeat
USING BRANCHES

• Very, very fast
• Keep different code paths separate
• Try new things
• Atomic merges!
SURVEY

• How many of you use branching?
• Do you work exclusively on trunk/master?
• NEVER work on trunk/master?
BRANCHING

c1   c2   c3   c4




          c5   c6
LET’S BRANCH!
~/gitbasics $ git checkout -b new_feature
Switched to a new branch quot;new_featurequot;

~/gitbasics $ git branch
  master
* new_feature

~/gitbasics $ git checkout master
Switched to branch quot;masterquot;

~/gitbasics $ git branch -d feature3
Deleted branch feature3
MERGING

• Merge two branches together
• Add new features
• Add bugs fixes
MERGING

c1   c2   c3   c4   c7




          c5   c6
MERGING

~/gitbasics $ git checkout master
Switched to branch quot;masterquot;

~/gitbasics $ git merge new_feature
REBASING

• Bring a branch up-to-date
• Rebasing is rewriting history!
• Don’t use rebasing on a branch you’re
  sharing!
REBASING

c1   c2    c3    c4




           c3’   c4’   c5   c6
REBASING

~/gitbasics $ git checkout new_feature
Switched to branch quot;new_featurequot;

~/gitbasics $ git rebase master
REMOTE

• Store and share your code!
 • github.com
 • gitosis ( self-managed over SSH )
PUSH

~/gitbasics $ git add origin git@github.com/ariejan/
gitbasics.git

~/gitbasics $ git push origin master
FETCH / PULL


~/gitbasics $ git fetch origin

~/gitbasics $ git pull origin master
WORKFLOW
             Working Directory

add


                Staging Area

                          checkout   merge
 commit


                Repository

                                         pull
      push               fetch

                  Remote
TAGGING


• Mark a point in history
• Optionally sign it cryptographically with
  GnuPG
TAGGING
      v1.0




c1    c2     c3   c4
TAGGING

~/gitbasics $ git tag -a -m quot;Tag v1.0quot; v1.0
Switched to branch quot;new_featurequot;

~/gitbasics $ git tag
v1.0

~/gitbasics $ git push --tags
BISECTING


• Binary search for a bad commit
• Find out where it when wrong (and who to
  blame)
BISECTING

     v1.0        Good or Bad?



c1   c2     c3   c4        c5   c6   c7
BISECTING
~/gitbasics $ git bisect start
~/gitbasics $ git bisect bad
~/gitbasics $ git bisect good v1.0

~/gitbasics $ git bisect bad | good

~/gitbasics $ git bisect reset

~/gitbasics $ git bisect start HEAD v1.0
RELEASE
    MANAGEMENT

• Manage your DTSP environments
• Branches to the rescue!
RELEASE
             MANAGEMENT

~/gitbasics $ git branch production master

~/gitbasics $ git push origin production

~/gitbasics $ git checkout --track -b production origin/production
RELEASE
             MANAGEMENT

~/gitbasics $ git checkout production

~/gitbasics $ git rebase master

~/gitbasics $ git push origin production
TAGGING RELEASES

~/gitbasics $ git checkout master

~/gitbasics $ git tag -a -m quot;Tag v1.0.3quot; v1.0.3
~/gitbasics $ git push --tags

~/gitbasics $ git checkout production
~/gitbasics $ git rebase v1.0.3
~/gitbasics $ git push origin production
THE STASH


• Stash away uncommited changes
• Ideal for quick bug fixes!
THE STASH
~/gitbasics $ git status
#	 modified:   README

~/gitbasics $ git stash
~/gitbasics $ git status
nothing to commit

# Hack, stage, review, commit, etc.

~/gitbasics $ git stash pop
~/gitbasics $ git status
#	 modified:   README
CONFLICTS

• Conflicts happen
• Git is clever
• Easy to resolve manually
• Merges are atomic!
CONFLICTS
~/gitbasics $ git merge awesome_feature
Auto-merged README
CONFLICT (content): Merge conflict in README
Automatic merge failed; fix conflicts and
then commit the result.

~/gitbasics $ vim README
~/gitbasics $ git add README
~/gitbasics $ git commit -m “fixed merge
conflict”
.GITIGNORE

• Specify which files to keep out of git
 • Location specific configuration
 • Generated files
 • Binary build files
.GITIGNORE

~/gitbasics $ cat .gitignore
config/database.yml
log/*.log
tmp/*
public/system/uploads/*
SURVEY


• Who is going to try Git?
• Stick with SubVersion?
WE’RE HIRING!
  AWESOME CODERS


  recruitment@kabisa.nl
THANKS!

Slides will be posted to http://slideshare.net/ariejan
          Contact me at ariejan@kabisa.nl

Mais conteúdo relacionado

Mais procurados (20)

Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Git tutorial
Git tutorialGit tutorial
Git tutorial
 
Github
GithubGithub
Github
 
Git and Github
Git and GithubGit and Github
Git and Github
 
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
 
Inside GitHub with Chris Wanstrath
Inside GitHub with Chris WanstrathInside GitHub with Chris Wanstrath
Inside GitHub with Chris Wanstrath
 
Git advanced
Git advancedGit advanced
Git advanced
 
Advanced Git Tutorial
Advanced Git TutorialAdvanced Git Tutorial
Advanced Git Tutorial
 
Git, from the beginning
Git, from the beginningGit, from the beginning
Git, from the beginning
 
Advanced Git Presentation By Swawibe
Advanced Git Presentation By SwawibeAdvanced Git Presentation By Swawibe
Advanced Git Presentation By Swawibe
 
Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)Introduction to Git (Greg Lonnon)
Introduction to Git (Greg Lonnon)
 
Grokking opensource with github
Grokking opensource with githubGrokking opensource with github
Grokking opensource with github
 
Introduction to Git / Github
Introduction to Git / GithubIntroduction to Git / Github
Introduction to Git / Github
 
Git - Get Ready To Use It
Git - Get Ready To Use ItGit - Get Ready To Use It
Git - Get Ready To Use It
 
Presentacion git
Presentacion gitPresentacion git
Presentacion git
 
Git Real
Git RealGit Real
Git Real
 
The Fundamentals of Git
The Fundamentals of GitThe Fundamentals of Git
The Fundamentals of Git
 
Git real slides
Git real slidesGit real slides
Git real slides
 
Git internals
Git internalsGit internals
Git internals
 
Git & Github for beginners
Git & Github for beginnersGit & Github for beginners
Git & Github for beginners
 

Destaque

互联网系统的稳定性保证:微博的实践
互联网系统的稳定性保证:微博的实践互联网系统的稳定性保证:微博的实践
互联网系统的稳定性保证:微博的实践XiaoJun Hong
 
Mysql参数-GDB
Mysql参数-GDBMysql参数-GDB
Mysql参数-GDBzhaolinjnu
 
2010丹臣的思考
2010丹臣的思考2010丹臣的思考
2010丹臣的思考zhaolinjnu
 
新浪微博redis技术演化
新浪微博redis技术演化新浪微博redis技术演化
新浪微博redis技术演化XiaoJun Hong
 
Inno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structureInno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structurezhaolinjnu
 
Mysql展示功能与源码对应
Mysql展示功能与源码对应Mysql展示功能与源码对应
Mysql展示功能与源码对应zhaolinjnu
 
大规模数据库存储方案
大规模数据库存储方案大规模数据库存储方案
大规模数据库存储方案XiaoJun Hong
 
Feed服务架构-新浪微博新员工培训议题
Feed服务架构-新浪微博新员工培训议题Feed服务架构-新浪微博新员工培训议题
Feed服务架构-新浪微博新员工培训议题XiaoJun Hong
 
分布式缓存与队列
分布式缓存与队列分布式缓存与队列
分布式缓存与队列XiaoJun Hong
 
突发事件中重点信息的筛选与分类
突发事件中重点信息的筛选与分类突发事件中重点信息的筛选与分类
突发事件中重点信息的筛选与分类XiaoJun Hong
 
新浪微博分布式缓存与队列-2013版
新浪微博分布式缓存与队列-2013版新浪微博分布式缓存与队列-2013版
新浪微博分布式缓存与队列-2013版XiaoJun Hong
 
redis 适用场景与实现
redis 适用场景与实现redis 适用场景与实现
redis 适用场景与实现iammutex
 
Build scalable microblog qcon beijing 2010
Build scalable microblog qcon beijing 2010Build scalable microblog qcon beijing 2010
Build scalable microblog qcon beijing 2010Tim Y
 
Hbase源码初探
Hbase源码初探Hbase源码初探
Hbase源码初探zhaolinjnu
 
淘宝数据库架构演进历程
淘宝数据库架构演进历程淘宝数据库架构演进历程
淘宝数据库架构演进历程zhaolinjnu
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterJohn Adams
 
大型系统的缓存标准化之路—从主从多级重client到一体化
大型系统的缓存标准化之路—从主从多级重client到一体化大型系统的缓存标准化之路—从主从多级重client到一体化
大型系统的缓存标准化之路—从主从多级重client到一体化XiaoJun Hong
 
High Performance Weibo QCon Beijing 2011
High Performance Weibo QCon Beijing 2011High Performance Weibo QCon Beijing 2011
High Performance Weibo QCon Beijing 2011Tim Y
 
新浪微博Feed服务架构
新浪微博Feed服务架构新浪微博Feed服务架构
新浪微博Feed服务架构XiaoJun Hong
 

Destaque (20)

互联网系统的稳定性保证:微博的实践
互联网系统的稳定性保证:微博的实践互联网系统的稳定性保证:微博的实践
互联网系统的稳定性保证:微博的实践
 
Mysql参数-GDB
Mysql参数-GDBMysql参数-GDB
Mysql参数-GDB
 
2010丹臣的思考
2010丹臣的思考2010丹臣的思考
2010丹臣的思考
 
新浪微博redis技术演化
新浪微博redis技术演化新浪微博redis技术演化
新浪微博redis技术演化
 
Inno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structureInno db internals innodb file formats and source code structure
Inno db internals innodb file formats and source code structure
 
Mysql展示功能与源码对应
Mysql展示功能与源码对应Mysql展示功能与源码对应
Mysql展示功能与源码对应
 
大规模数据库存储方案
大规模数据库存储方案大规模数据库存储方案
大规模数据库存储方案
 
Feed服务架构-新浪微博新员工培训议题
Feed服务架构-新浪微博新员工培训议题Feed服务架构-新浪微博新员工培训议题
Feed服务架构-新浪微博新员工培训议题
 
分布式缓存与队列
分布式缓存与队列分布式缓存与队列
分布式缓存与队列
 
突发事件中重点信息的筛选与分类
突发事件中重点信息的筛选与分类突发事件中重点信息的筛选与分类
突发事件中重点信息的筛选与分类
 
新浪微博分布式缓存与队列-2013版
新浪微博分布式缓存与队列-2013版新浪微博分布式缓存与队列-2013版
新浪微博分布式缓存与队列-2013版
 
redis 适用场景与实现
redis 适用场景与实现redis 适用场景与实现
redis 适用场景与实现
 
Build scalable microblog qcon beijing 2010
Build scalable microblog qcon beijing 2010Build scalable microblog qcon beijing 2010
Build scalable microblog qcon beijing 2010
 
Hbase源码初探
Hbase源码初探Hbase源码初探
Hbase源码初探
 
淘宝数据库架构演进历程
淘宝数据库架构演进历程淘宝数据库架构演进历程
淘宝数据库架构演进历程
 
Chirp 2010: Scaling Twitter
Chirp 2010: Scaling TwitterChirp 2010: Scaling Twitter
Chirp 2010: Scaling Twitter
 
MySQL aio
MySQL aioMySQL aio
MySQL aio
 
大型系统的缓存标准化之路—从主从多级重client到一体化
大型系统的缓存标准化之路—从主从多级重client到一体化大型系统的缓存标准化之路—从主从多级重client到一体化
大型系统的缓存标准化之路—从主从多级重client到一体化
 
High Performance Weibo QCon Beijing 2011
High Performance Weibo QCon Beijing 2011High Performance Weibo QCon Beijing 2011
High Performance Weibo QCon Beijing 2011
 
新浪微博Feed服务架构
新浪微博Feed服务架构新浪微博Feed服务架构
新浪微博Feed服务架构
 

Semelhante a Git Basics - RubyFest 2009

Git Started With Git
Git Started With GitGit Started With Git
Git Started With GitNick Quaranto
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Bosstmacwilliam
 
Smalltalk on Git
Smalltalk on GitSmalltalk on Git
Smalltalk on Gitmattmatt
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSMatthew McCullough
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSMatthew McCullough
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control SystemVictor Wong
 
Git Aliases of the Gods!
Git Aliases of the Gods!Git Aliases of the Gods!
Git Aliases of the Gods!Atlassian
 
Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciBecoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciAtlassian
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlBecky Todd
 
Git For The Android Developer
Git For The Android DeveloperGit For The Android Developer
Git For The Android DeveloperEffective
 
Getting some Git
Getting some GitGetting some Git
Getting some GitBADR
 

Semelhante a Git Basics - RubyFest 2009 (20)

Git Basics Philips
Git Basics PhilipsGit Basics Philips
Git Basics Philips
 
Git Started With Git
Git Started With GitGit Started With Git
Git Started With Git
 
Git Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a BossGit Magic: Versioning Files like a Boss
Git Magic: Versioning Files like a Boss
 
Smalltalk on Git
Smalltalk on GitSmalltalk on Git
Smalltalk on Git
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCS
 
Git - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCSGit - Intro to the Basics of DVCS
Git - Intro to the Basics of DVCS
 
Loading...git
Loading...gitLoading...git
Loading...git
 
Git
GitGit
Git
 
Git Distributed Version Control System
Git   Distributed Version Control SystemGit   Distributed Version Control System
Git Distributed Version Control System
 
git session --interactive
git session --interactivegit session --interactive
git session --interactive
 
Becoming a Git Master
Becoming a Git MasterBecoming a Git Master
Becoming a Git Master
 
Wokshop de Git
Wokshop de Git Wokshop de Git
Wokshop de Git
 
Git Aliases of the Gods!
Git Aliases of the Gods!Git Aliases of the Gods!
Git Aliases of the Gods!
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Becoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola PaolucciBecoming a Git Master - Nicola Paolucci
Becoming a Git Master - Nicola Paolucci
 
Git
GitGit
Git
 
Git Tech Talk
Git  Tech TalkGit  Tech Talk
Git Tech Talk
 
Git the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version controlGit the Docs: A fun, hands-on introduction to version control
Git the Docs: A fun, hands-on introduction to version control
 
Git For The Android Developer
Git For The Android DeveloperGit For The Android Developer
Git For The Android Developer
 
Getting some Git
Getting some GitGetting some Git
Getting some Git
 

Último

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
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
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
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
 
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
 
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
 
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
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 

Último (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
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
 
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
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
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...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
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
 
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
 
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
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 

Git Basics - RubyFest 2009

  • 1. GIT BASICS by Ariejan de Vroom – Kabisa ICT
  • 2. WHAT THE GIT?! “I'm an egotistical bastard, and I name all my projects after myself. First Linux, now git.” – Linus Torvalds
  • 4.
  • 5. SURVEY • Who is NOT using version control? • SubVersion? • Anything else?
  • 6. WHY GIT?! • Distributed Repositories • Non-linear Development • Very fast branching and merging • Toolkit Design • Scales • Cryptographic authentication of history.
  • 7. LET’S ROCK! ~/gitbasics $ git init Initialized empty Git repository in /Users/ariejan/gitbasics/.git/
  • 8. LET’S ROLL! ~/gitbasics $ git clone git@github.com/ariejan/gitbasics.git
  • 9. ~/gitbasics $ echo quot;Live long and prosperquot; > README ~/gitbasics $ git add README ~/gitbasics $ git commit -m quot;Added READMEquot; [master (root-commit)]: created 8e60b09: quot;Added READMEquot; 1 files changed, 1 insertions(+), 0 deletions(-) create mode 100644 README
  • 10. WHAT JUST HAPPENED? ~/gitbasics $ git log commit 8e60b09d3082e9473944075cc01b3b67bb97d5c3 Author: Ariejan de Vroom <ariejan@ariejan.net> Date: Mon May 11 21:51:24 2009 +0200 Added README
  • 11. HOW GIT WORKS Working Directory git add Staging Area git commit Repository
  • 12. WORKFLOW • Hack! ( TextMate, vim, ... ) • Stage your changes ( git add ) • Review your changes ( git status | diff ) • Commit (locally) ( git commit ) • Repeat
  • 13. USING BRANCHES • Very, very fast • Keep different code paths separate • Try new things • Atomic merges!
  • 14. SURVEY • How many of you use branching? • Do you work exclusively on trunk/master? • NEVER work on trunk/master?
  • 15. BRANCHING c1 c2 c3 c4 c5 c6
  • 16. LET’S BRANCH! ~/gitbasics $ git checkout -b new_feature Switched to a new branch quot;new_featurequot; ~/gitbasics $ git branch master * new_feature ~/gitbasics $ git checkout master Switched to branch quot;masterquot; ~/gitbasics $ git branch -d feature3 Deleted branch feature3
  • 17. MERGING • Merge two branches together • Add new features • Add bugs fixes
  • 18. MERGING c1 c2 c3 c4 c7 c5 c6
  • 19. MERGING ~/gitbasics $ git checkout master Switched to branch quot;masterquot; ~/gitbasics $ git merge new_feature
  • 20. REBASING • Bring a branch up-to-date • Rebasing is rewriting history! • Don’t use rebasing on a branch you’re sharing!
  • 21. REBASING c1 c2 c3 c4 c3’ c4’ c5 c6
  • 22. REBASING ~/gitbasics $ git checkout new_feature Switched to branch quot;new_featurequot; ~/gitbasics $ git rebase master
  • 23. REMOTE • Store and share your code! • github.com • gitosis ( self-managed over SSH )
  • 24. PUSH ~/gitbasics $ git add origin git@github.com/ariejan/ gitbasics.git ~/gitbasics $ git push origin master
  • 25. FETCH / PULL ~/gitbasics $ git fetch origin ~/gitbasics $ git pull origin master
  • 26. WORKFLOW Working Directory add Staging Area checkout merge commit Repository pull push fetch Remote
  • 27. TAGGING • Mark a point in history • Optionally sign it cryptographically with GnuPG
  • 28. TAGGING v1.0 c1 c2 c3 c4
  • 29. TAGGING ~/gitbasics $ git tag -a -m quot;Tag v1.0quot; v1.0 Switched to branch quot;new_featurequot; ~/gitbasics $ git tag v1.0 ~/gitbasics $ git push --tags
  • 30. BISECTING • Binary search for a bad commit • Find out where it when wrong (and who to blame)
  • 31. BISECTING v1.0 Good or Bad? c1 c2 c3 c4 c5 c6 c7
  • 32. BISECTING ~/gitbasics $ git bisect start ~/gitbasics $ git bisect bad ~/gitbasics $ git bisect good v1.0 ~/gitbasics $ git bisect bad | good ~/gitbasics $ git bisect reset ~/gitbasics $ git bisect start HEAD v1.0
  • 33. RELEASE MANAGEMENT • Manage your DTSP environments • Branches to the rescue!
  • 34. RELEASE MANAGEMENT ~/gitbasics $ git branch production master ~/gitbasics $ git push origin production ~/gitbasics $ git checkout --track -b production origin/production
  • 35. RELEASE MANAGEMENT ~/gitbasics $ git checkout production ~/gitbasics $ git rebase master ~/gitbasics $ git push origin production
  • 36. TAGGING RELEASES ~/gitbasics $ git checkout master ~/gitbasics $ git tag -a -m quot;Tag v1.0.3quot; v1.0.3 ~/gitbasics $ git push --tags ~/gitbasics $ git checkout production ~/gitbasics $ git rebase v1.0.3 ~/gitbasics $ git push origin production
  • 37. THE STASH • Stash away uncommited changes • Ideal for quick bug fixes!
  • 38. THE STASH ~/gitbasics $ git status # modified: README ~/gitbasics $ git stash ~/gitbasics $ git status nothing to commit # Hack, stage, review, commit, etc. ~/gitbasics $ git stash pop ~/gitbasics $ git status # modified: README
  • 39. CONFLICTS • Conflicts happen • Git is clever • Easy to resolve manually • Merges are atomic!
  • 40. CONFLICTS ~/gitbasics $ git merge awesome_feature Auto-merged README CONFLICT (content): Merge conflict in README Automatic merge failed; fix conflicts and then commit the result. ~/gitbasics $ vim README ~/gitbasics $ git add README ~/gitbasics $ git commit -m “fixed merge conflict”
  • 41. .GITIGNORE • Specify which files to keep out of git • Location specific configuration • Generated files • Binary build files
  • 42. .GITIGNORE ~/gitbasics $ cat .gitignore config/database.yml log/*.log tmp/* public/system/uploads/*
  • 43. SURVEY • Who is going to try Git? • Stick with SubVersion?
  • 44. WE’RE HIRING! AWESOME CODERS recruitment@kabisa.nl
  • 45. THANKS! Slides will be posted to http://slideshare.net/ariejan Contact me at ariejan@kabisa.nl

Notas do Editor