Git development
 help / color / mirror / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Jan Rychter <jan@rychter.com>
Cc: git@vger.kernel.org
Subject: Re: Idea: "live branches"?
Date: Wed, 9 Jul 2008 18:00:46 +0100 (BST)	[thread overview]
Message-ID: <alpine.DEB.1.00.0807091750350.18205@racer> (raw)
In-Reply-To: <m28wwbz8h7.fsf@tnuctip.rychter.com>

Hi,

On Wed, 9 Jul 2008, Jan Rychter wrote:

> Which brings me to my point. I think we need a system that can maintain 
> "live branches". We already have impressive systems for dealing with 
> patches and we have made the patch into a first-class citizen of our 
> software development world. Now, instead of statically tracking commits 
> and following a one-way development history, let's have live branches -- 
> branches that can change, causing code that depends on them to change.
> 
> The way this would work is I would have one or two long-term development 
> branches, and each of those would depend on a list of "live branches", 
> managed by a tool similar to StGIT. I should be able to commit to either 
> the main development branch, or to one of the "live branches", in which 
> case I should be able to easily "resync" the main development branch (do 
> a merge or a rebase, but I would prefer the tool to first remove old 
> merge commits, so as not to clutter history).

It should be very easy to write a small shell script which expects some 
config variable

	branch.<currentBranchName>.liveBranches

which contains a list of (local) branches.  It would then just look which 
of those branches contains newer commits, finds the merges that pulled 
those branches in, and redoes those merges (and the commits).  It would 
rely heavily on "git reset" and on an untampered-with merge message.

The main loop would look a little bit like this:

	git rev-list --parents <first-merge-to-be-replaced>^ |
	while read commit parent otherparents
	do
		case "$otherparents" in
		'')
			git cherry-pick $commit
		;;
		*)
			case " $commit " in
			" $mergestoberedone ")
			;;
			*)
				message="$(git cat-file commit $commit |
					sed '/^$/q')"
				git merge -m "$message" $otherparents
			;;
		esac
	done
	# merge changes branches

No wizardry required.

> The tool should also let me pick a commit I've made and move it to one 
> of the live branches easily (similar to stgit).

That is relatively simple, using "git checkout <branch> && git cherry-pick 
<commit> && git checkout <formerBranch> && git resync-live-branches".

I strongly suggest writing that script, and seeing if it is useful for 
you.  If it is, just submit it and earn all the glory.

Hth,
Dscho

      parent reply	other threads:[~2008-07-09 17:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-09  9:56 Idea: "live branches"? Jan Rychter
2008-07-09 16:48 ` Avery Pennarun
2008-07-09 17:00 ` Johannes Schindelin [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=alpine.DEB.1.00.0807091750350.18205@racer \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jan@rychter.com \
    /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