SlideShare ist ein Scribd-Unternehmen logo
1 von 86
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie 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
 

Ähnlich wie 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...
 

Kürzlich hochgeladen

COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptxJIT KUMAR GUPTA
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086anil_gaur
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxmaisarahman1
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startQuintin Balsdon
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxnuruddin69
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesRAJNEESHKUMAR341697
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARKOUSTAV SARKAR
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsvanyagupta248
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfsmsksolar
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 

Kürzlich hochgeladen (20)

COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak HamilCara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
Cara Menggugurkan Sperma Yang Masuk Rahim Biyar Tidak Hamil
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
Bridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptxBridge Jacking Design Sample Calculation.pptx
Bridge Jacking Design Sample Calculation.pptx
 
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced LoadsFEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
FEA Based Level 3 Assessment of Deformed Tanks with Fluid Induced Loads
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Engineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planesEngineering Drawing focus on projection of planes
Engineering Drawing focus on projection of planes
 
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKARHAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
HAND TOOLS USED AT ELECTRONICS WORK PRESENTED BY KOUSTAV SARKAR
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
AIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech studentsAIRCANVAS[1].pdf mini project for btech students
AIRCANVAS[1].pdf mini project for btech students
 
Rums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdfRums floating Omkareshwar FSPV IM_16112021.pdf
Rums floating Omkareshwar FSPV IM_16112021.pdf
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 

Getting Git Right