SlideShare a Scribd company logo
1 of 36
Download to read offline
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
HPLiveNetworkMeetGit
Liran Tal
2013
Goodbye merge hell, conflicts, and awfully slow svn operations
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Motivation
“Already know you that which you need” - Yoda
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.3
Motivation
Decentralized
• Faster, really.
• Complete repository clone.
• Developers can work “offline”, committing all their work locally and pushing to a ‘primary’ repository later.
• Redundant and enterprise-ready, if required.
Lightweight Branches
• Cheap and quick
• Used often, and merged often.
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.4
Motivation
Drives for better development methodology
• Gitflow – A successful git branching model
• Code reviews
Extra curriculum points for reading 
− http://nvie.com/posts/a-successful-git-branching-model
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
Roadmap
“Always in motion, the future is” - Yoda
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.6
Roadmap
Plans for implementing Git in HP Live Network.
Using Git,
better, all of us
• Gradually
migrating the
rest of the R&D
teams to Git
Using Git,
better
• Working with
Gitflow
development
methodology
Using Git
• Preliminary
evaluation of Git
• Understanding
Git – knowledge
gap
• Migrating
backend SVN
repository to Git
• Using Git in a
single team (3
developers) as
case study
Git kick-off
• Motivation for
Git
• Roadmap
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
GitOverview
“Try not. Do or do not, there is no try” - Yoda
(heavily based on Git Pro book, @see git-scm.com/book)
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.8
Git Overview
CVCS
SVN operations mostly need to consult a remote
server repository
DVCS
Git operations mostly run on the local
repository (and later pushed to a remote
server)
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.9
Git Overview
Changes
SVN-like data model
Gnapshots
Git maintains a snapshot of the data
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.10
Git Overview
The Three States
• Modified
• Staged (the staging area is also known as the index)
• Committed
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.11
Git Overview
Git For Work
• IntelliJ
− In our experience Eclipse with EGIT support is awful
• PHPStorm – bundled with Git integration
• Command line Git, my preferred option
Other Git Tools
• TortoiseGit
• Gitk
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
GitBasics
“Try not. Do or do not, there is no try” - Yoda
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.13
Initializing a git repository
Git Basics
Starting fresh
• git init
Working from an existing repository
• git clone <repository-url>
− we know this as ‘svn checkout <repository-url>’
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.14
Adding work
Git Basics
Commiting your work
• git add <file>
− git add -p <file>
− git add -I <file>
• git status
• git commit [file] -m <commit-message>
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.15
Common commands
Git Basics
Commiting your work
• git status
• git branch
• git diff
− --staged – see changes between staged to last commit
• git rm
• git mv
• .gitignore
• git log
− -p – view diff
− --stat – view a summary of commit file stats
− --pretty=oneline --pretty=full or --pretty=format:”%h - %an, %ar : %s”
− --graph
− --since=2.weeks
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.16
Undoing
Git Basics
Undoing changes
• git commit –amend
− Commits the staging area again instead of the previous commit
• git reset HEAD <file>
− Unstage a previously staged file
• git checkout -- <file>
− Revert local changes to that file
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.17
Remotes
Git Basics
Working with Remotes
• git remote -v
− Lists remotes configured for this repository
• git remote add <shortname> <url>
− Adding a remote
• git fetch <remote> <branch>
− Fetch the changes from the remote repository (not yet merging them)
• git pull <remote> <branch>
− Fetch and merge changes from the remote repository to the local branch
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.18
Remotes
Git Basics
Working with Remotes
• git push <remote> <branch>
− Push your changes to the remote repository
− Pushing is only successful if your local copy is up to date with the remote
• git remote show <remote>
− Inspecting the remote for information
• git remote rename <remote> <new-remote>
− Renaming a remote
• git remote rm <remote>
− Removing a remote
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.19
Tagging
Git Basics
Lightweight and Annotated Tags
• git tag -a v2.0 -m “portal release 2.0” [hash]
− Annotated tags (notice the -a flag) are saved as full Git objects meaning they contain author information,
email, checksum, etc.
• git tag v2.0
− Lightweight tags are just pointers to a commit (don’t provide -a, -m or -s)
• git push <remote> --tags
− Pushing our tags to the remote repository as they don’t get pushed with a plain ‘git push’
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
GitBranches
“Try not. Do or do not, there is no try” - Yoda
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.21
Git Branches
Overview
• Diverge from the main line of development and continue to do work without messing with that main line
• Expensive process, often requiring you to create a new copy of your source code directory
Git killer branching
• Incredibly lightweight and prompt
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.22
Git Branches
Overview
• Stream-line a development methodology
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.23
Git Branches
Starting off
• Starting on a fresh ‘master’ branch with 3 files:
− README
− License
− test.rb
• After performing git add && git commit, an example visual
representation is as such:
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.24
Git Branches
Starting off
• With each commit in time a new commit object is created and objects are pointing to parents (zero or more)
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.25
Git Branches
Starting off
• The ‘master’ branch is simply a pointer that moves forward with each commit you make
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.26
Git Branches
Branching off
• Creating new branches means creating new pointers to a certain commit
• git branch testing
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.27
Git Branches
Branching off
• HEAD pointer is used to point to the local branch you’re working on now
• We’re still on ‘master’ cause we only created a new branch (testing) but didn’t yet
switch to it
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.28
Git Branches
Branching off
• HEAD pointer is used to point to the local branch you’re working on now
• We’re still on ‘master’ cause we only created a new branch (testing) but didn’t yet
switch to it
• git checkout testing
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.29
Git Branches
Branching off
• HEAD and testing branch pointers are both updated with each new commit
• git commit -a -m “new file”
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.30
Git Branches
Branching off
• Going back to our original ‘master’ branch:
− Updated the HEAD pointer
− Working directory looks different now, representing the state of the ‘master’ branch
• git checkout master
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.31
Git Branches
Diverged road
• Commiting work on the master branch again will diverge and enable us to work on 2 paths
• git commit -a -m “another commit”
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.32
Git Branches
Re-cap
• Branches are simply pointers
• Due to commits data structure it is easy enough to find proper merge base and that process is mostly done
automatic for us
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.
WebPresenceforGit
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.34
Gitblit
Gitblit
• Open source Java project for hosting Git repositories
• Includes a web interface for managing and interacting with repositories (attempts to live up to the Github
promise)
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.35
Gitblit
Gitblit
• Open source Java project for hosting Git repositories
• Includes a web interface for managing and interacting with repositories (attempts to live up to the Github
promise)
• Includes a Java UI to manage users and their
certificates
• Feature-full, including repository federation
and other cool stuff
© Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.36
Gitblit
User Setup
• Configure your git:
− git config --global http.sslverify false
− git config --global http.sslkey /pathto/lirantal.key
− git config --global http.sslcert /pathto/lirantal.pem
− git config --global http.proxy ""
− git config --global user.name "Liran Tal"
− git config --global user.email "liran.tal@hp.com"
• You’re ready to clone:
git clone https://gitserver:8443/git/hpln.git

More Related Content

What's hot

Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...
Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...
Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...donaghmccabe
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Gitatishgoswami
 
Migrating from Grails 2 to Grails 3
Migrating from Grails 2 to Grails 3Migrating from Grails 2 to Grails 3
Migrating from Grails 2 to Grails 3Michael Plöd
 
July OpenNTF Webinar - HCL Presents Keep, a new API for Domino
July OpenNTF Webinar - HCL Presents Keep, a new API for DominoJuly OpenNTF Webinar - HCL Presents Keep, a new API for Domino
July OpenNTF Webinar - HCL Presents Keep, a new API for DominoHoward Greenberg
 
Getting Started with Apache Geode
Getting Started with Apache GeodeGetting Started with Apache Geode
Getting Started with Apache GeodeJohn Blum
 
BYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiBYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiDataWorks Summit
 
What Big Data Folks Need to Know About DevOps
What Big Data Folks Need to Know About DevOpsWhat Big Data Folks Need to Know About DevOps
What Big Data Folks Need to Know About DevOpsMatt Ray
 
Apache Geode (incubating) Introduction with Docker
Apache Geode (incubating) Introduction with DockerApache Geode (incubating) Introduction with Docker
Apache Geode (incubating) Introduction with DockerWilliam Markito Oliveira
 
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of GitGit Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of GitNicola Costantino
 
Advanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesAdvanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesBrent Laster
 
How to use Hadoop for operational and transactional purposes by RODRIGO MERI...
 How to use Hadoop for operational and transactional purposes by RODRIGO MERI... How to use Hadoop for operational and transactional purposes by RODRIGO MERI...
How to use Hadoop for operational and transactional purposes by RODRIGO MERI...Big Data Spain
 
How to Open Source an Internal Project
How to Open Source an Internal ProjectHow to Open Source an Internal Project
How to Open Source an Internal ProjectAll Things Open
 
Adding ACID Transactions, Inserts, Updates, and Deletes in Apache Hive
Adding ACID Transactions, Inserts, Updates, and Deletes in Apache HiveAdding ACID Transactions, Inserts, Updates, and Deletes in Apache Hive
Adding ACID Transactions, Inserts, Updates, and Deletes in Apache HiveDataWorks Summit
 
Oracle on kubernetes 101 - Dec/2021
Oracle on kubernetes 101 - Dec/2021Oracle on kubernetes 101 - Dec/2021
Oracle on kubernetes 101 - Dec/2021Nelson Calero
 
The Evolution of Glance API: On the Way From v1 to v3
The Evolution of Glance API: On the Way From v1 to v3The Evolution of Glance API: On the Way From v1 to v3
The Evolution of Glance API: On the Way From v1 to v3Brian Rosmaita
 

What's hot (20)

Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...
Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...
Openstack Summit Vancouver 2015 - Maintaining and Operating Swift at Public C...
 
Introduction to Git
Introduction to GitIntroduction to Git
Introduction to Git
 
Working with Git
Working with GitWorking with Git
Working with Git
 
Introduction to git
Introduction to gitIntroduction to git
Introduction to git
 
Migrating from Grails 2 to Grails 3
Migrating from Grails 2 to Grails 3Migrating from Grails 2 to Grails 3
Migrating from Grails 2 to Grails 3
 
July OpenNTF Webinar - HCL Presents Keep, a new API for Domino
July OpenNTF Webinar - HCL Presents Keep, a new API for DominoJuly OpenNTF Webinar - HCL Presents Keep, a new API for Domino
July OpenNTF Webinar - HCL Presents Keep, a new API for Domino
 
Getting Started with Apache Geode
Getting Started with Apache GeodeGetting Started with Apache Geode
Getting Started with Apache Geode
 
BYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFiBYOP: Custom Processor Development with Apache NiFi
BYOP: Custom Processor Development with Apache NiFi
 
What Big Data Folks Need to Know About DevOps
What Big Data Folks Need to Know About DevOpsWhat Big Data Folks Need to Know About DevOps
What Big Data Folks Need to Know About DevOps
 
Talk to git
Talk to gitTalk to git
Talk to git
 
DevOps tools for winning agility
DevOps tools for winning agilityDevOps tools for winning agility
DevOps tools for winning agility
 
Apache Geode (incubating) Introduction with Docker
Apache Geode (incubating) Introduction with DockerApache Geode (incubating) Introduction with Docker
Apache Geode (incubating) Introduction with Docker
 
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of GitGit Is A State Of Mind - The path to becoming a Master of the mystic art of Git
Git Is A State Of Mind - The path to becoming a Master of the mystic art of Git
 
Advanced Git: Functionality and Features
Advanced Git: Functionality and FeaturesAdvanced Git: Functionality and Features
Advanced Git: Functionality and Features
 
How to use Hadoop for operational and transactional purposes by RODRIGO MERI...
 How to use Hadoop for operational and transactional purposes by RODRIGO MERI... How to use Hadoop for operational and transactional purposes by RODRIGO MERI...
How to use Hadoop for operational and transactional purposes by RODRIGO MERI...
 
How to Open Source an Internal Project
How to Open Source an Internal ProjectHow to Open Source an Internal Project
How to Open Source an Internal Project
 
Adding ACID Transactions, Inserts, Updates, and Deletes in Apache Hive
Adding ACID Transactions, Inserts, Updates, and Deletes in Apache HiveAdding ACID Transactions, Inserts, Updates, and Deletes in Apache Hive
Adding ACID Transactions, Inserts, Updates, and Deletes in Apache Hive
 
Oracle on kubernetes 101 - Dec/2021
Oracle on kubernetes 101 - Dec/2021Oracle on kubernetes 101 - Dec/2021
Oracle on kubernetes 101 - Dec/2021
 
The Evolution of Glance API: On the Way From v1 to v3
The Evolution of Glance API: On the Way From v1 to v3The Evolution of Glance API: On the Way From v1 to v3
The Evolution of Glance API: On the Way From v1 to v3
 
Git vs. Mercurial
Git vs. MercurialGit vs. Mercurial
Git vs. Mercurial
 

Similar to HPLN Meet Git - Public

Similar to HPLN Meet Git - Public (20)

Git more
Git moreGit more
Git more
 
Bitbucket as a code server and pmt
Bitbucket as a code server and pmt Bitbucket as a code server and pmt
Bitbucket as a code server and pmt
 
Git workshop
Git workshopGit workshop
Git workshop
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
 
Git & Github
Git & GithubGit & Github
Git & Github
 
3 Git
3 Git3 Git
3 Git
 
Lets git to it
Lets git to itLets git to it
Lets git to it
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Mini-training: Let’s Git It!
Mini-training: Let’s Git It!Mini-training: Let’s Git It!
Mini-training: Let’s Git It!
 
Git installation and configuration
Git installation and configurationGit installation and configuration
Git installation and configuration
 
Git
GitGit
Git
 
01 - Git vs SVN
01 - Git vs SVN01 - Git vs SVN
01 - Git vs SVN
 
Git walkthrough
Git walkthroughGit walkthrough
Git walkthrough
 
Introduction to git hub
Introduction to git hubIntroduction to git hub
Introduction to git hub
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Git tips
Git tipsGit tips
Git tips
 
Open up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHubOpen up your platform with Open Source and GitHub
Open up your platform with Open Source and GitHub
 
Git
GitGit
Git
 
Git Educated About Git - 20 Essential Commands
Git Educated About Git - 20 Essential CommandsGit Educated About Git - 20 Essential Commands
Git Educated About Git - 20 Essential Commands
 
Introduction to Git for Network Engineers
Introduction to Git for Network EngineersIntroduction to Git for Network Engineers
Introduction to Git for Network Engineers
 

Recently uploaded

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsPrecisely
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
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
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort ServiceHot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
Hot Sexy call girls in Panjabi Bagh 🔝 9953056974 🔝 Delhi escort Service
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Unlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power SystemsUnlocking the Potential of the Cloud for IBM Power Systems
Unlocking the Potential of the Cloud for IBM Power Systems
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

HPLN Meet Git - Public

  • 1. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. HPLiveNetworkMeetGit Liran Tal 2013 Goodbye merge hell, conflicts, and awfully slow svn operations
  • 2. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. Motivation “Already know you that which you need” - Yoda
  • 3. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.3 Motivation Decentralized • Faster, really. • Complete repository clone. • Developers can work “offline”, committing all their work locally and pushing to a ‘primary’ repository later. • Redundant and enterprise-ready, if required. Lightweight Branches • Cheap and quick • Used often, and merged often.
  • 4. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.4 Motivation Drives for better development methodology • Gitflow – A successful git branching model • Code reviews Extra curriculum points for reading  − http://nvie.com/posts/a-successful-git-branching-model
  • 5. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. Roadmap “Always in motion, the future is” - Yoda
  • 6. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.6 Roadmap Plans for implementing Git in HP Live Network. Using Git, better, all of us • Gradually migrating the rest of the R&D teams to Git Using Git, better • Working with Gitflow development methodology Using Git • Preliminary evaluation of Git • Understanding Git – knowledge gap • Migrating backend SVN repository to Git • Using Git in a single team (3 developers) as case study Git kick-off • Motivation for Git • Roadmap
  • 7. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. GitOverview “Try not. Do or do not, there is no try” - Yoda (heavily based on Git Pro book, @see git-scm.com/book)
  • 8. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.8 Git Overview CVCS SVN operations mostly need to consult a remote server repository DVCS Git operations mostly run on the local repository (and later pushed to a remote server)
  • 9. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.9 Git Overview Changes SVN-like data model Gnapshots Git maintains a snapshot of the data
  • 10. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.10 Git Overview The Three States • Modified • Staged (the staging area is also known as the index) • Committed
  • 11. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.11 Git Overview Git For Work • IntelliJ − In our experience Eclipse with EGIT support is awful • PHPStorm – bundled with Git integration • Command line Git, my preferred option Other Git Tools • TortoiseGit • Gitk
  • 12. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. GitBasics “Try not. Do or do not, there is no try” - Yoda
  • 13. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.13 Initializing a git repository Git Basics Starting fresh • git init Working from an existing repository • git clone <repository-url> − we know this as ‘svn checkout <repository-url>’
  • 14. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.14 Adding work Git Basics Commiting your work • git add <file> − git add -p <file> − git add -I <file> • git status • git commit [file] -m <commit-message>
  • 15. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.15 Common commands Git Basics Commiting your work • git status • git branch • git diff − --staged – see changes between staged to last commit • git rm • git mv • .gitignore • git log − -p – view diff − --stat – view a summary of commit file stats − --pretty=oneline --pretty=full or --pretty=format:”%h - %an, %ar : %s” − --graph − --since=2.weeks
  • 16. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.16 Undoing Git Basics Undoing changes • git commit –amend − Commits the staging area again instead of the previous commit • git reset HEAD <file> − Unstage a previously staged file • git checkout -- <file> − Revert local changes to that file
  • 17. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.17 Remotes Git Basics Working with Remotes • git remote -v − Lists remotes configured for this repository • git remote add <shortname> <url> − Adding a remote • git fetch <remote> <branch> − Fetch the changes from the remote repository (not yet merging them) • git pull <remote> <branch> − Fetch and merge changes from the remote repository to the local branch
  • 18. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.18 Remotes Git Basics Working with Remotes • git push <remote> <branch> − Push your changes to the remote repository − Pushing is only successful if your local copy is up to date with the remote • git remote show <remote> − Inspecting the remote for information • git remote rename <remote> <new-remote> − Renaming a remote • git remote rm <remote> − Removing a remote
  • 19. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.19 Tagging Git Basics Lightweight and Annotated Tags • git tag -a v2.0 -m “portal release 2.0” [hash] − Annotated tags (notice the -a flag) are saved as full Git objects meaning they contain author information, email, checksum, etc. • git tag v2.0 − Lightweight tags are just pointers to a commit (don’t provide -a, -m or -s) • git push <remote> --tags − Pushing our tags to the remote repository as they don’t get pushed with a plain ‘git push’
  • 20. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. GitBranches “Try not. Do or do not, there is no try” - Yoda
  • 21. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.21 Git Branches Overview • Diverge from the main line of development and continue to do work without messing with that main line • Expensive process, often requiring you to create a new copy of your source code directory Git killer branching • Incredibly lightweight and prompt
  • 22. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.22 Git Branches Overview • Stream-line a development methodology
  • 23. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.23 Git Branches Starting off • Starting on a fresh ‘master’ branch with 3 files: − README − License − test.rb • After performing git add && git commit, an example visual representation is as such:
  • 24. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.24 Git Branches Starting off • With each commit in time a new commit object is created and objects are pointing to parents (zero or more)
  • 25. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.25 Git Branches Starting off • The ‘master’ branch is simply a pointer that moves forward with each commit you make
  • 26. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.26 Git Branches Branching off • Creating new branches means creating new pointers to a certain commit • git branch testing
  • 27. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.27 Git Branches Branching off • HEAD pointer is used to point to the local branch you’re working on now • We’re still on ‘master’ cause we only created a new branch (testing) but didn’t yet switch to it
  • 28. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.28 Git Branches Branching off • HEAD pointer is used to point to the local branch you’re working on now • We’re still on ‘master’ cause we only created a new branch (testing) but didn’t yet switch to it • git checkout testing
  • 29. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.29 Git Branches Branching off • HEAD and testing branch pointers are both updated with each new commit • git commit -a -m “new file”
  • 30. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.30 Git Branches Branching off • Going back to our original ‘master’ branch: − Updated the HEAD pointer − Working directory looks different now, representing the state of the ‘master’ branch • git checkout master
  • 31. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.31 Git Branches Diverged road • Commiting work on the master branch again will diverge and enable us to work on 2 paths • git commit -a -m “another commit”
  • 32. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.32 Git Branches Re-cap • Branches are simply pointers • Due to commits data structure it is easy enough to find proper merge base and that process is mostly done automatic for us
  • 33. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice. WebPresenceforGit
  • 34. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.34 Gitblit Gitblit • Open source Java project for hosting Git repositories • Includes a web interface for managing and interacting with repositories (attempts to live up to the Github promise)
  • 35. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.35 Gitblit Gitblit • Open source Java project for hosting Git repositories • Includes a web interface for managing and interacting with repositories (attempts to live up to the Github promise) • Includes a Java UI to manage users and their certificates • Feature-full, including repository federation and other cool stuff
  • 36. © Copyright 2012 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice.36 Gitblit User Setup • Configure your git: − git config --global http.sslverify false − git config --global http.sslkey /pathto/lirantal.key − git config --global http.sslcert /pathto/lirantal.pem − git config --global http.proxy "" − git config --global user.name "Liran Tal" − git config --global user.email "liran.tal@hp.com" • You’re ready to clone: git clone https://gitserver:8443/git/hpln.git