Branch Management in Git Fusion
Transcript of Branch Management in Git Fusion
2
Helix Branches vs. Git Branches
1. Compare Helix and Git data models2. Changing branch mappings3. Lightweight and Fully-populated branches4. Ghost changelists
3
Helix Branch Data Model
• Branches of depot hierarchy• Set of files and the changes made to each file over time• Tracks integration history between branches for each file
4
Git Concepts not in Helix
• Commit hierarchy• Branch references• Common history across branches• Anonymous branches
“Master Git,” said the historian, “what is the nature of history?”
“History is immutable. To rewrite it later is to tamper with the very fabric of existence.”
- Only the Gods, Git Koans, Steve Losh
“I have a historical record of a merge commit with two parents. How can I find out which branch each parent was originally made on?”
“History is ephemeral,” replied Master Git,“the knowledge you seek can be answered only by the gods.”
- Only the Gods, Git Koans, Steve Losh
8
Git Branches
• A branch is simply a pointer to a commit• History is a stream or series of workspace snapshots
9
Helix Concepts not in Git
• Depot hierarchy• Client view mapping• File actions• Individual file revisions are not tracked• File integration history• Branch on which a commit was made
11
Changing Branch Mappings
• Adding a new branch• Removing a branch or depot path• Adding a depot path to existing branch mapping• Adding a branch mapping with pre-existing history
12
Branch Mapping in Git Fusion
[projx1-master]git-branch-name = masterview = //depot/projx/main/src/... ...
[projx1-stage]git-branch-name = stageview = //depot/projx/stage/src/... ...
stream = //Projx/mainline #stream example
13
Add A New Branch Mapping
1. Create the branch in Helix2. Add mapping to the repo config3. git pull
14
Add A New Branch Mapping
New branch in Git you want to push to a depot path
1. Add mapping to repo config2. git push origin branch-name
18
New Depot Path on Existing Mapping
[projx1-master]
git-branch-name = master
view = //depot/projx/main/src/... ...
20
New Depot Path on Existing Mapping
[projx1-master]
git-branch-name = master
view = //depot/projx/main/src/... ...
//depot/projx/main/doc/... doc/...
26
New Branch with Pre-Existing History
[projx1-master]git-branch-name = masterview = //depot/projx/main/src/... ...
-//depot/projx/main/src/doc/... doc/...//depot/projx/main/doc/... doc/...
[projx1-stage]git-branch-name = stageview = //depot/projx/stage/src/... ...
-//depot/projx/stage/src/doc/... doc/...//depot/projx/stage/doc/... doc/...
29
Changing Branch Mappings
• Fabric of space and time remains intact• Cannot affect history• Best if you get it right the first time
32
Fully-Populated Branches
• Fully-populated branches reflect the Git workspace• Mapped branches are fully-populated branches• Create fully-populated depot path on the fly
33
Fully-Populated Branches
depot-branch-creation-enableno : Unmapped branches are lightweightall : Unmapped branches are fully-populatedexplicit : Hybrid
depot-branch-creation-depot-path: {repo} {git_branch_name} {user}
depot-branch-creation-p4group
34
Fully-Populated Branches
[@repo]description = Projx1 repo
depot-branch-creation-enable = explicit
depot-branch-creation-depot-path = //depot/{repo}/{user}/{git_branch_name}
$ git push origin mytask:depot-branch/mytask
//depot/projx1/jkovisto/mytask/...
35
Who’s Afraid Of Ghosts?
Ghost changelists make Helix history reflect Git History
• One-to-one mapping between Git and Perforce file actions
• Diffing against previous revision
36
What Manifests a Ghost?
• Pushing to a new fully-populated depot path• Pushing to a commit to a new lightweight branch• Push that must make the depot reflect a commit’s parent
37
Identifying Ghost Changes
Change 14378 by git-fusion-user@git-fusion--temp-1-jk-centos-64-projx1 on 2016/02/23 14:02:16
Git Fusion branch management Imported from Git ghost-of-change-num: 14360 ghost-of-sha1: 709b0d2dd013dfe86022197633e528cc9db8c3f1 ghost-precedes-sha1: bff18f1bfb9e63a3a6e773deee946579457b210 parent-branch: None@14360 push-state: incomplete
38
Branch Management Planning
• Anticipate branch mapping needs• New fully-populated branches in real time• Recognize ghosts