Branch Management in Git Fusion

40
Branch Management in Git Fusion Joel Kovisto Technical Account Manager

Transcript of Branch Management in Git Fusion

Branch Management in Git FusionJoel KovistoTechnical Account Manager

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

6

Anatomy of a Commit

• Comment• Author• Committer• Tree• Parent(s)

“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

What will it mean if I change branch mappings?

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

15

Removing a Branchor Depot Path

Can I add a depot path to an existing branch mapping?

17

New Depot Path on Existing Mapping

18

New Depot Path on Existing Mapping

[projx1-master]

git-branch-name = master

view = //depot/projx/main/src/... ...

19

New Depot Path on Existing Mapping

Changes to docs not included

20

New Depot Path on Existing Mapping

[projx1-master]

git-branch-name = master

view = //depot/projx/main/src/... ...

//depot/projx/main/doc/... doc/...

21

New Depot Path on Existing Mapping

22

New Depot Path on Existing Mapping

23

New Depot Path on Existing Mapping

24

New Depot Path on Existing Mapping

What if I add a new branch mapping with old history?

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/...

27

Both Branches Always Mapped

28

New Branch with Pre-Existing History

29

Changing Branch Mappings

• Fabric of space and time remains intact• Cannot affect history• Best if you get it right the first time

30

Lightweight vs. Fully Populated Branches

• Lightweight branches• Fully-populated brances

31

Lightweight Branches

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

Q&A

Thank youMeet me at the Helix Hive

[email protected]