git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Smirl <jonsmirl@gmail.com>
To: git <git@vger.kernel.org>
Subject: Using local trees and cogito
Date: Wed, 15 Jun 2005 22:37:59 -0400	[thread overview]
Message-ID: <9e473391050615193719d81951@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1474 bytes --]

I took Jeff Garzik's scripts for managing multiple trees and reworked
them a little for cogito. I changed the names to something that makes
more sense to me, but what does everyone think? Or can cogito already
do this I just can't figure it out?

In my terminology forks are different tree heads in the same git tree
(local branches).

cg-fork fname -- make a new tree head from the current tree and switch to it.
cg-goto fname -- switch the current working tree to one of the forks.
cg-goto -- display the name of the current fork
cg-goto -l -- display the name of all forks
cg-diff fname -- diff the current working tree to a fork
cg-merge fname -- merge another fork into the current fork

I fixed goto to not jump if there are pending changes. Is there a
better way to do this?

Is fork a good name since branches refer to other git trees? I'm
somewhat confused about exactly what a branch consists of, it looks to
me like the path to another external tree.

I do find Jeff's work very useful since it allows me to keep twenty
patches in a single tree and jump between them. This is better than bk
where I had to keep multiple entire trees with a build in each of
them. This way I only rebuild the files that changed after a jump.

One problem I did notice is that if you add file in a fork and jump to
a fork without the file, it doesn't get removed. That's not a big
problem but it can be confusing.

-- 
Jon Smirl
jonsmirl@gmail.com

[-- Attachment #2: cg-fork --]
[-- Type: application/octet-stream, Size: 251 bytes --]

#!/bin/sh

if [ ! -d .git/refs/heads ]
then
	echo Cannot find .git metadata, aborting.
	exit 1
fi

FN=".git/refs/heads/$1"

if [ -f $FN ]
then
	echo Branch $1 exists, moving to $1.old.
	mv -f $FN $FN.old
fi

cp .git/refs/heads/master $FN

cg-goto $1


[-- Attachment #3: cg-goto --]
[-- Type: application/octet-stream, Size: 421 bytes --]

#!/bin/sh

if [ "$1" == "-l" ]
then
	ls .git/refs/heads
elif [ "x$1" != "x" ]
then
	if [ ! -f .git/refs/heads/$1 ]
	then
		echo Branch $1 not found.
		exit 1
	fi
	diff=$(git-diff-cache -r -p HEAD)
	if [ "x$diff" != "x" ]
	then
		echo "Commit pending changes first"
		exit 1
	fi
	( cd .git && rm -f HEAD && ln -s refs/heads/$1 HEAD )

	git-read-tree -m HEAD && git-checkout-cache -q -f -u -a
else
	readlink .git/HEAD
fi



             reply	other threads:[~2005-06-16  2:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-16  2:37 Jon Smirl [this message]
2005-06-16 16:39 ` Using local trees and cogito Jan Harkes
2005-06-17 11:57   ` Matthias Urlichs

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=9e473391050615193719d81951@mail.gmail.com \
    --to=jonsmirl@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;
as well as URLs for NNTP newsgroup(s).