How can I use two “development flows” (branches?), Tracking each other, staying different in different ways?

SUMMARY:

I want two (or more) "development flows" / environments to track each other, sending changes to each other in both directions, not converging completely - keeping certain keys, significant differences?

DETAILS, ONE FREQUENT EXAMPLE:

Here is one specific example:

I was the version running my home directory, glew-home, for, oh, 28 years old. RCS, SCCS, many RCS, CVS, SVN wrappers, a short period of experimentation with early DVCS such as Monotone and Darcs, bzr, git, and now Mercurial. At the moment, I'm mostly happy using Mercurial, although I will return to git or bzr as needed.

Now my home directory is similar but not identical on many systems. The biggest differences between Cygwin and the various Linuxes at work. I try to make them as funny as possible, but differences arise, and often they need to be maintained.

Here is a trivial example of differences: on Cygwin, on my own laptop, ~ / LOG is a symbolic link to ~ / LOG.dir / LOG.cygwin.glew-home, and at work ~ / LOG there is a symbolic link to something like ~ / work / LOG.dir / LOG.work.

Reason: everything you need should stay at work. ~ / work is a separate repository, ~ / work / .hg, and is NOT portable / pulled out or not synchronized with other personal computers.

Problem: I want to keep these symbolic links (and several other files) different. But I want to sync all other files. I am making changes to my environment in both places. If I make changes to my ~ / .emacs at work, I want to send them home, and vice versa.

Q: How can I do this most conveniently?

In the good old days, I would use a common repository, say a common CVS repository. CVS does not handle symbolic links, but I will say that I had a script that generated symbolic links from a template stored in CVS. I would suggest a symlink template for ~ / LOG to have different branches for my cygwin laptop and for work. I would create workspaces with most files pointing to the same branch of their respective RCS / CVS repositories, while files that differed between cygwin-linux and work would have corresponding corresponding branches checked for the corresponding workspaces.

It worked, although it was a little painful to maintain.

I have not found a good way to do this using modern DVCS such as Mercurial (or Got or Bzr).

These state-of-the-art DVCS tools branch out entire repos rather than branching files. They do not understand the concept of two branches, which are identical for most files, but which differ only in certain files.

When I try to track two branches, I always get significant differences that propagate.

Some suggested a makefile. Not attractive.

I considered making significant changes to the revs database and constantly reinstalling it. But I don’t like to adapt so much.

Best ideas appreciated.

Blanket?

+6
source share
1 answer

In git, you can support the master branch with all common files (possibly plus different ones in some state by default) and custom branches like work or cygwin .

If you want to make changes that should apply to each machine, you do this in master . If you want something to be available only for / cygwin, you do it in the appropriate branch.

When you pull new changes from master on the machine on which the dedicated branch is configured, you just need to git merge master or git rebase master from this branch.

Which one you should use is a matter of preference, the final working directory is the same, only the story is different. Using merge , you will always see when you update a customized branch with changes from master . Using rebase , it will look like all the settings move away from the tip of the wizard, as if you first performed everything in the main and only then made any settings.

Unfortunately, I have no idea about other DVCS, since I have no experience with them, however, I find this procedure for git quite simple.

+4
source

Source: https://habr.com/ru/post/922012/


All Articles