Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed GIT workflow suggestion
    primarykey
    data
    text
    <p>I have been studding GIT for the last couple of weeks in an attempt to get my team's code under control. Unfortunately the code we work with is a proprietary language with some peculiarities which is keeping me from finding a practical enough workflow to be implemented. Still, I'm probably not aware of all GIT's capabilities so I ask you guys for suggestion. I will divide this post in three: 1) how are my files; 2)the workflow we've figured so far; 3)options I reckon for the future.</p> <p><em>My Files then;</em></p> <p>As I said this is a proprietary script language, in which within the code itself you will find tags regarding configurations (servers, DB's and other stuff). It might sound strange, I know, but technically this code <em>is</em> a big complex configuration file. Well, it can not be changed, for now lets just leave it.</p> <p>I also have two different environments: <code>dev</code> and <code>prod</code>, and I guess it's uses are evident. Due the odd way the code is thought, if you compare the script in <code>dev</code> to the same one in <code>prod</code> you would see:</p> <p><strong>prod:</strong></p> <pre><code>CodeCode += Code(0) Code{1} ... CodeConfig = "ConnectionToProducionDB" SomeMoreGenericCode.doSomething() (...) </code></pre> <p>And in <strong>dev</strong> it would look like:</p> <pre><code>CodeCode += Code(0) Code{1} ... CodeConfig = "GoToSomeDevDB" SomeMoreGenericCode.doSomething() (...) </code></pre> <p>That would be it regarding the files.</p> <p><em>Now, what have been figured;</em></p> <p>At first glance, it seemed for me a classical <em>lets branch it</em> situation and so I've done.</p> <pre><code>[create a folder and init it] [copy my code from production and add/commit it] $ git checkout -b dev [change these lines with 'CodeConfig' to the dev settings] [go happy coding and commiting] </code></pre> <p>After a while, coding and tests are done and it is time to merge into production. That's when the problem starts.</p> <p>A simple <code>git merge dev</code> (from my master branch) will merge the codes mostly ok, but the configs will be also transferred to the master branch, as from GIT's POV this is one of the updates in the code itself. While in this short code it wouldn't be a problem, in the real situation I might have re-configured ten or twenty sources and rolling back one at time isn't quite a pleasant (nor a reliable) task.</p> <p>Of course, when using branches I do want to be able to merge my code in order to keep my commit history and comments. I just need it to be done in a more customized way...</p> <p>I have tried a couple different things to work this out, but had no success. Seems that GIT's merge is just too smart for me :(</p> <p>For instance, <code>*.xml merge=Unset</code> into my <code>.gitattributes</code> file. Or a custom merge driver into ~/.gitconfig trying to cause the auto-merge to fail (not sure if I got that right though).</p> <p><em>Possible solutions I thought;</em></p> <p>As I said, I am probably not aware of all GIT's functions, so my options are bound by those I know. I appreciate your innovation ;)</p> <p>I though the simplest way would be if I could disable any auto merging and do it all manually (the codes aren't so large, and I'd have to look into it anyway). After that I'd create a simple merge driver that would pass all the code changes (not only the conflicts) to something like WinMerge or Kdiff3 where I'd get the job done. Unfortunately I didn't manage to get it this way yet.</p> <p>My last attempt resulted in a lengthy and unpractical workflow, but I'll write it here so you can have an idea of my goal.</p> <ol> <li>init repo <code>proj1</code></li> <li>copy <code>prod</code> files</li> <li>first add/commit</li> <li><code>$ git checkout -b dev</code></li> <li>configure <code>dev</code> settings</li> <li>code/commit dev cycle</li> <li>copy dev files to <code>tmpDevDir</code></li> <li><code>$ git checkout master</code></li> <li>use WinMerge to compare <code>tmpDevDir</code> against <code>proj1[master branch]</code> and apply only desired changes</li> <li>commit <code>proj1[master branch]</code></li> <li><code>$ git merge dev</code></li> <li>merge conflicts where needed</li> <li><code>$ git diff HEAD HEAD^</code> to review merge result and revert the merged configs</li> <li><code>$ git commit -am 'final commit for the production code'</code></li> </ol> <p>And well... not nice.</p> <p>Would anyone have ideas for a more practical workflow or other commands which would help this out?</p> <p>thanks a lot,</p> <p>f.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload