SlideShare une entreprise Scribd logo
1  sur  86
Télécharger pour lire hors ligne
MANJUNATH | SOURCETREE DEVELOPER | @MANJUNATHIBS
Getting Git Right
with Bitbucket and Sourcetree
It’s the little details that
are vital. Little things
make big things happen.
- John Wooden
Agenda
Git Basics
Stash, Patch and Reset
Merge vs Rebase
Unity + Sourcetree
Migrate to Git
Tracking history
Why
?
Speed, Speed, Speed
Everything is local
© Disney/Pixar
Chapter Title Here
Spilled coffee on hard drive?
Malicious vandalism?
Data center hit by 

meteor?
Accidental branch deletion?
No biggie!
We’re
on
rm -rf in the wrong 

directory?
Peer pressure
92%
8%
Bitbucket repositories, Git vs Hg
Git objects
Blob
Tree
Commit SHA
Parent
Author
Committer
Date
Directed Acyclic Graph
Ref -> Mutable pointer to an
object
Usually a commit
refs/head/master -> commit fecd6578…
Automatically store DAG
For objects rooted at these refs
Collection of Refs
branches and tagsGit
Repository
Ref -> Mutable pointer to an
object
Usually a commit
refs/head/master -> commit fecd6578…
Automatically store DAG
For objects rooted at these refs
Collection of Refs
branches and tagsGit
Repository
Ref -> Mutable pointer to an
object
Usually a commit
refs/head/master -> commit fecd6578…
Automatically store DAG
For objects rooted at these refs
Collection of Refs
branches and tagsGit
Repository
master
98ca9..
bab1e..
fad3d..
434bb..
98ca9..
bab1e..
fad3d..
master
98ca9..
bab1e..
fad3d..
master
Branches are just Refs
pointers into DAG of commitsGit
Branch
Lightweight Branching &
Merging
Can have any number of branches
Lightweight Branching &
Merging
Can have any number of branches
Branches are just Refs
pointers into DAG of commitsGit
Branch
Tracking History
Branches & Tags
shader-upgrade
stable master branch
isolated feature work
master
Branching workflow
Tags
trivia!
Which hashing algorithm
does git use for generating
commit IDs?
SHA-1 MD5
The git DAG (which stores
refs, trees and blobs)
stands for..
Directed
Acyclic
Graph
Data
Agnostic
Graph
The git checkout command
can be used to check out an
existing branch.	
True False
The git checkout command can
be used to create a new branch.
True False
The git 1.0.0 release was tagged
in which year?	
2005 2006
TIE-BREAKER
The first git commit message by
Linus Torvalds reads: “Initial
revision of git…
…bye-bye
Bitkeeper”
…the
information
manager
from hell”
Stash, Patch & Reset
Getting around common mistakes
Wrong commit
Pushed a commit on the
wrong branch?
Common mistakes
Need to switch
Can’t commit but want to
switch to a new branch?
Wrong branch
Have local changes, but on
the wrong branch
Same branch
Works best only when you apply these changes
on the same branch.
Small - Big changes
Acts as an archive for changes when you want
to switch branch without having to commit or
loose you changes when you switch
Need to
Switch?
Stash
Apply stash
Whenever you are ready to resume work, apply
your stash on the branch
Same branch
Works best only when you apply these changes
on the same branch.
Small - Big changes
Acts as an archive for changes when you want
to switch branch without having to commit or
loose you changes when you switch
Need to
Switch?
Stash
Apply stash
Whenever you are ready to resume work, apply
your stash on the branch
Same branch
Works best only when you apply these changes
on the same branch.
Small - Big changes
Acts as an archive for changes when you want
to switch branch without having to commit or
loose you changes when you switch
Need to
Switch?
Stash
Apply stash
Whenever you are ready to resume work, apply
your stash on the branch
Stash
List
Switch branch
Switch to another branch or create a new
branch
Small changes
Ideal with small changes. Saved on disk as a diff
file.
Wrong
branch?
Patch
Apply Patch
Select and apply the patch in the new branch
Switch branch
Switch to another branch or create a new
branch
Small changes
Ideal with small changesWrong
branch?
Patch
Apply Patch
Select and apply the patch in the new branch
Switch branch
Switch to another branch or create a new
branch
Small changes
Ideal with small changesWrong
branch?
Patch
Apply Patch
Select and apply the patch in the new branch
Reset to commit
You could also reset the branch to an earlier
commit. This is a destructive action using reset.
Reverse commit
If you’ve already pushed the change to remote,
just revert it and this will roll back changes with
an extra commit. Uses revert
Wrong
commit?
Reset
If changes are local, you could just run clean and
the branch will be pristine
Reset to commit
You could also reset the branch to an earlier
commit. This is a destructive action using reset.
Reverse commit
If you’ve already pushed the change to remote,
just revert it and this will roll back changes with
an extra commit. Uses revert
Wrong
commit?
Reset
If changes are local, you could just run clean and
the branch will be pristine
Reset to commit
You could also reset the branch to an earlier
commit. This is a destructive action using reset.
Reverse commit
If you’ve already pushed the change to remote,
just revert it and this will roll back changes with
an extra commit. Uses revert
Wrong
commit?
Reset
If changes are local, you could just run clean and
the branch will be pristine. Uses clean internally.
Merge vs Rebase
Understanding how to bring two branches together
BEFORE MERGE AFTER MERGE
BEFORE REBASE AFTER REBASE
Unity + Sourcetree
How using Sourcetree can make your life easier
Git ignore
https://github.com/github/gitignore/blob/master/Unity.gitignore
Migrating to Git LFS
☞
98ca9..
bab1e..
fad3d..
☞
100mb
150mb
150mb!?!?
$ git lfs track “*.obj”
Unity Smart Merge
Merge Command: Path to UnityYAMLMerge
Arguments: merge -p $BASE $REMOTE $LOCAL $MERGED
Migrate to Git
go.atlassian.com/svn-to-git
go.atlassian.com/p4-to-git
https://www.atlassian.com/git/tutorials/svn-to-git-prepping-
your-team-migration
What about the
bucket ?
https://bitbucket.org/repo/import/
LFS
Store rich media and
large data in your
repos
Code Aware
Search
Semantic search that
ranks definitions first
Issue tracker
Use integrated issue
tracker backed by
JIRA and even a
Trello board
Pipelines
Integrated CI/CD
Bitbucket
Bitbucket Pipelines
CI & CD right from within your repository
Build Status
bit.ly/unity-git
Unity + Git config
go.atlassian.com/bitbucket-unity
Bitbucket ❤ Unity
go.atlassian.com/git-lfs
Git LFS
bitbucket.org
Bitbucket Cloud
Looking
for
more?
Git Documentation
git-scm.com/documentation
MANJUNATH | @MANJUNATHIBS
I know that was a lot ;)
Thank you

Contenu connexe

Similaire à Getting Git Right

Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)Yeasin Abedin
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get GitSusan Tan
 
Using Git on the Command Line
Using Git on the Command LineUsing Git on the Command Line
Using Git on the Command LineBrian Richards
 
Git basics with notes
Git basics with notesGit basics with notes
Git basics with notesSurabhi Gupta
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for developmentGerrit Wanderer
 
WPGR - Intro to Git (on the Command Line)
WPGR - Intro to Git (on the Command Line)WPGR - Intro to Git (on the Command Line)
WPGR - Intro to Git (on the Command Line)Brian Richards
 
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git John Tighe
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainLemi Orhan Ergin
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitaminAlex Hillman
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystemFrançois D'Agostini
 
Real World Git Workflows - EclipseCon Europe 2013
Real World Git Workflows - EclipseCon Europe 2013Real World Git Workflows - EclipseCon Europe 2013
Real World Git Workflows - EclipseCon Europe 2013Nicola Paolucci
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdfTilton2
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideRaghavendraVattikuti1
 
Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Pao...
Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Pao...Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Pao...
Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Pao...hamidsamadi
 

Similaire à Getting Git Right (20)

Git usage (Basics and workflow)
Git usage (Basics and workflow)Git usage (Basics and workflow)
Git usage (Basics and workflow)
 
Git made-it easy
Git made-it easyGit made-it easy
Git made-it easy
 
How to Really Get Git
How to Really Get GitHow to Really Get Git
How to Really Get Git
 
Git
GitGit
Git
 
Using Git on the Command Line
Using Git on the Command LineUsing Git on the Command Line
Using Git on the Command Line
 
Intro to Gitflow
Intro to GitflowIntro to Gitflow
Intro to Gitflow
 
Git Rebase vs Merge
Git Rebase vs MergeGit Rebase vs Merge
Git Rebase vs Merge
 
Git basics with notes
Git basics with notesGit basics with notes
Git basics with notes
 
Checkitmobile - using Git for development
Checkitmobile - using Git for developmentCheckitmobile - using Git for development
Checkitmobile - using Git for development
 
WPGR - Intro to Git (on the Command Line)
WPGR - Intro to Git (on the Command Line)WPGR - Intro to Git (on the Command Line)
WPGR - Intro to Git (on the Command Line)
 
Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git Git 101 - An introduction to Version Control using Git
Git 101 - An introduction to Version Control using Git
 
Git Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it AgainGit Anti-Patterns: How To Mess Up With Git and Love it Again
Git Anti-Patterns: How To Mess Up With Git and Love it Again
 
Version Control ThinkVitamin
Version Control ThinkVitaminVersion Control ThinkVitamin
Version Control ThinkVitamin
 
Git basics
Git basicsGit basics
Git basics
 
Git basics a starter on git and its ecosystem
Git basics  a starter on git and its ecosystemGit basics  a starter on git and its ecosystem
Git basics a starter on git and its ecosystem
 
Learn Git Basics
Learn Git BasicsLearn Git Basics
Learn Git Basics
 
Real World Git Workflows - EclipseCon Europe 2013
Real World Git Workflows - EclipseCon Europe 2013Real World Git Workflows - EclipseCon Europe 2013
Real World Git Workflows - EclipseCon Europe 2013
 
Git and Github slides.pdf
Git and Github slides.pdfGit and Github slides.pdf
Git and Github slides.pdf
 
Git and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slideGit and Github workshop ppt slide by slide
Git and Github workshop ppt slide by slide
 
Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Pao...
Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Pao...Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Pao...
Git workflows á la-carte, Presenation at jdays2013 www.jdays.se by Nicola Pao...
 

Dernier

Artificial Intelligence Bayesian Reasoning
Artificial Intelligence Bayesian ReasoningArtificial Intelligence Bayesian Reasoning
Artificial Intelligence Bayesian Reasoninghotman30312
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxwendy cai
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDrGurudutt
 
Intelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsIntelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsSheetal Jain
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdfKamal Acharya
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1T.D. Shashikala
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectRased Khan
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AISheetal Jain
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsMathias Magdowski
 
Lect_Z_Transform_Main_digital_image_processing.pptx
Lect_Z_Transform_Main_digital_image_processing.pptxLect_Z_Transform_Main_digital_image_processing.pptx
Lect_Z_Transform_Main_digital_image_processing.pptxMonirHossain707319
 
Paint shop management system project report.pdf
Paint shop management system project report.pdfPaint shop management system project report.pdf
Paint shop management system project report.pdfKamal Acharya
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Lovely Professional University
 
ChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdfChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdfqasastareekh
 
Supermarket billing system project report..pdf
Supermarket billing system project report..pdfSupermarket billing system project report..pdf
Supermarket billing system project report..pdfKamal Acharya
 
solid state electronics ktu module 5 slides
solid state electronics ktu module 5 slidessolid state electronics ktu module 5 slides
solid state electronics ktu module 5 slidesARUN AV
 
How to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdfHow to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdftawat puangthong
 
ROAD CONSTRUCTION PRESENTATION.PPTX.pptx
ROAD CONSTRUCTION PRESENTATION.PPTX.pptxROAD CONSTRUCTION PRESENTATION.PPTX.pptx
ROAD CONSTRUCTION PRESENTATION.PPTX.pptxGagandeepKaur617299
 
Attraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxAttraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxkarthikeyanS725446
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Prakhyath Rai
 
Online book store management system project.pdf
Online book store management system project.pdfOnline book store management system project.pdf
Online book store management system project.pdfKamal Acharya
 

Dernier (20)

Artificial Intelligence Bayesian Reasoning
Artificial Intelligence Bayesian ReasoningArtificial Intelligence Bayesian Reasoning
Artificial Intelligence Bayesian Reasoning
 
Construction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptxConstruction method of steel structure space frame .pptx
Construction method of steel structure space frame .pptx
 
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdfDR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
DR PROF ING GURUDUTT SAHNI WIKIPEDIA.pdf
 
Intelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent ActsIntelligent Agents, A discovery on How A Rational Agent Acts
Intelligent Agents, A discovery on How A Rational Agent Acts
 
Furniture showroom management system project.pdf
Furniture showroom management system project.pdfFurniture showroom management system project.pdf
Furniture showroom management system project.pdf
 
Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1Research Methodolgy & Intellectual Property Rights Series 1
Research Methodolgy & Intellectual Property Rights Series 1
 
Arduino based vehicle speed tracker project
Arduino based vehicle speed tracker projectArduino based vehicle speed tracker project
Arduino based vehicle speed tracker project
 
Introduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AIIntroduction to Artificial Intelligence and History of AI
Introduction to Artificial Intelligence and History of AI
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
Lect_Z_Transform_Main_digital_image_processing.pptx
Lect_Z_Transform_Main_digital_image_processing.pptxLect_Z_Transform_Main_digital_image_processing.pptx
Lect_Z_Transform_Main_digital_image_processing.pptx
 
Paint shop management system project report.pdf
Paint shop management system project report.pdfPaint shop management system project report.pdf
Paint shop management system project report.pdf
 
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
Activity Planning: Objectives, Project Schedule, Network Planning Model. Time...
 
ChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdfChatGPT Prompt Engineering for project managers.pdf
ChatGPT Prompt Engineering for project managers.pdf
 
Supermarket billing system project report..pdf
Supermarket billing system project report..pdfSupermarket billing system project report..pdf
Supermarket billing system project report..pdf
 
solid state electronics ktu module 5 slides
solid state electronics ktu module 5 slidessolid state electronics ktu module 5 slides
solid state electronics ktu module 5 slides
 
How to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdfHow to Design and spec harmonic filter.pdf
How to Design and spec harmonic filter.pdf
 
ROAD CONSTRUCTION PRESENTATION.PPTX.pptx
ROAD CONSTRUCTION PRESENTATION.PPTX.pptxROAD CONSTRUCTION PRESENTATION.PPTX.pptx
ROAD CONSTRUCTION PRESENTATION.PPTX.pptx
 
Attraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptxAttraction and Repulsion type Moving Iron Instruments.pptx
Attraction and Repulsion type Moving Iron Instruments.pptx
 
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...Software Engineering - Modelling Concepts + Class Modelling + Building the An...
Software Engineering - Modelling Concepts + Class Modelling + Building the An...
 
Online book store management system project.pdf
Online book store management system project.pdfOnline book store management system project.pdf
Online book store management system project.pdf
 

Getting Git Right