Git development
 help / color / mirror / Atom feed
From: Johannes Sixt <j.sixt@viscovery.net>
To: Tim Rupp <caphrim007@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: suggestions for local configs?
Date: Fri, 06 Nov 2009 08:21:39 +0100	[thread overview]
Message-ID: <4AF3CE83.1060400@viscovery.net> (raw)
In-Reply-To: <4AF393EE.4030205@gmail.com>

Tim Rupp schrieb:
> I have a piece of software that has default and local configuration
> files. The default files ship with the tarball. The local files are
> copied over from the default folder during installation and can be
> modified for a particular install.

This is how *I* would organize it, but it is a bit overengineered if the
changes needed in the configuration are only minimal:

  ---o--o--X1--o--o--X2--o          master (aka upstream)
      \     \             \
       R-----M1------------M3       rename
        \     \             \
         Y-----M2------------M4     production

We need two branches in addition to master, which tracks upstream version.

1. The first branch *renames* the example configuration to the effective
configuration:

   git mv foo.conf.example foo.conf
   # commit R
   git commit -m "Use the example configuration"

It is important that *no change* is made to the configuration file, and it
furthermore assumes that the production configuration (foo.conf) does not
exist [*].

The point of this commit is that git can determine that the file was
renamed with 100% similarity.

2. The second branch is actually where the customization happens, this is
commit Y:

   git checkout production
   edit foo.conf
   # commit Y
   git commit -m "configuration changes needed in production"


Assume, upstream made changes to the configuration (commit X1). These
changes are merged in the following way:

1.  git checkout rename && git merge master

This creates M1. git detects that on our side the file was renamed, and
merges the upstream changes into the renamed file. Since we didn't modify
the file in R, there are no conflicts.

2.  git checkout production && git merge rename

This creates M2. This is a regular merge that integrates upstream changes
with the local changes made in Y, possibly with conflicts.

You repeat the procedure when upstream makes more changes to the example
configuration in X2. This time, git merge again detects that the file was
renamed with 100% similarity, and things work just like with M1 and M2.

[*] If there is a configuration file in addition to the example
configuration, another branch is needed that removes it.

-- Hannes

      reply	other threads:[~2009-11-06  7:21 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-06  3:11 suggestions for local configs? Tim Rupp
2009-11-06  7:21 ` Johannes Sixt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AF3CE83.1060400@viscovery.net \
    --to=j.sixt@viscovery.net \
    --cc=caphrim007@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox