Constant merging required

John Whitley whitley at bangpath.org
Sun Mar 29 21:27:44 CEST 2015


Matthias Thubauville <matthias.thubo at gmail.com> wrote:
> However I've noticed the following:
> 
> Suppose I make modifications on two machines and commit them on both.

Hi Matthias,

The way I handle this is to set the "branch.master.rebase" config value to true in every vcsh managed repo, e.g.:

  git config branch.master.rebase true

See man git-config[1] for details on the setting "branch.<name>.rebase".

This creates a workflow where your local changes always land at the tip of origin/master.  So I'll "vcsh pull" then "vcsh push" on a given system (say, A), and that synchronizes origin/master with my changes from A.  When I'm next on B, I'll do the same two commands.  Any local changes will be rebased after my changes from A, then pushed up to master.

The result is a history that appears purely linear, with no merge commits at all.  For example, look at the commit history of one of my mr-managed repos [2].  All of my vcsh repos have had "overlapping" commits from different systems, but the history looks as if I've only ever used one box.

One more thing I've been meaning to do is to tweak my vcsh setup to default to branch.master.rebase to true on every repo.  I think one of the list members has mentioned using such a setup, but I can't find a reference to that just now.

Related thought about vcsh: I've been meaning to add a "vcsh each" command as a generalization of "vcsh {push,pull}".  E.g. "vcsh each git config branch.master.rebase true".  That would be handy in cases like this where I want to run some command in the context of every repository.  Useful for state normalization (e.g. this config change), reporting, etc.  Thoughts?

Last but not least, you can peruse my root vcsh/mr config at [3].  See the bootstrap.sh script on the bootstrap branch[4] for details.

Kudos and credit to @vdeemester for the bootstrap script approach[5].  If you check out my vcsh-root bootstrapper, note that I removed one limitation from his approach: I don't require that vcsh and mr be preinstalled.  They're tiny, so I've baked them into the vcsh-root repo, and periodically update them.  Bonus: I always get consistent versions no matter what platform I'm using.

Cheers,
John

[1] https://www.kernel.org/pub/software/scm/git/docs/git-config.html
[2] https://github.com/jwhitley/vimrc/commits/master
[3] https://github.com/jwhitley/vcsh-root
[4] https://github.com/jwhitley/vcsh-root/blob/bootstrap/bootstrap.sh
[5] https://github.com/vdemeester/vcsh-home



More information about the vcs-home mailing list