A week ago I used branches as a workflow to scotch-tape Angular SVG exported from Omnigraffle. I love Og, and for now, I love Angular. However there was an ulterior motive: proving Joe Walnes wrong a scenario of merging back changes from a ‘feature branch’ to where it came from. He’s way brighter than me, so when he points out you’re wrong (Fermat-style) you heed it and check your facts:

My claim, re Git:

“Just because you are continually merging from A->B, does not mean it’s cheap to do a final merge from B->A when you’re “done”

Joe’s response:

“Uhm, yes that’s exactly what it means.”

So off I went to contrive a test in Git. That Omnigraffle/Angular thing from a week ago was it. At least as attempt #1 at a disproof. It was also worthy of a blog entry in its own right (a workflow for Svg/Git/Angular).

I’ve renamed branches to match the language of the conversation with Joe. Thus as_from_omnigraffle_but_formatted is now A and with_angular_and_html is now B.

So now I have another Github repo. The same history of that first repo, is the starting point for this one. I want to show that semi-tricky merge-back scenario. Specifically from B to A. The new repo is https://github.com/paul-hammant/svg_merge_experiment2 and the pertinent commits are:

Add an XML ‘hello world’ comment in the SVG on the ‘A’ branch

(On Github)

This change has not been merged to the B branch. It is now the only A change that has not in some way been merged to the B branch.

Merge the ‘A’ branch back to ‘A’

What I want is the comment from above preserved, and everything else from B brought into A. The file contents should change from pure SVG to HTML with embedded SVG.

The Commit’s Diff:

(On Github)

You can’t see the ‘hello world’ comment from the previous commit, but it is there you just have to expand to see the full file.

There’s several ways you can look at the series of things Git did to merge back from B to A, but this change in summary is:

  1. The bulk of the “is now an angular app” changed formerly on B
  2. Specifically fill="red" (pure SVG) is now ng-attr-fill="{‌{eyeColor}‌}" (an Angular attribute)

Not messed up:

the @@ comment from before as mentioned.

Summary: I’m wrong, Joe’s right.



Published

March 15th, 2014
Reads:

Tags

Categories