git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* (cogito) Branch offf from older commit?
@ 2005-08-14 15:50 Wolfgang Denk
  2005-08-14 17:03 ` Linus Torvalds
  0 siblings, 1 reply; 2+ messages in thread
From: Wolfgang Denk @ 2005-08-14 15:50 UTC (permalink / raw
  To: git

Is there (in cogito) a way to  start  a  branch  off  from  an  older
commit?

Assume I receive a patch whichis based on an old version which I want
to test first (and resolve problems) in a separate branch.

This was what I tried:

* Clone main repo:
	-> cg-clone /git/u-boot u-boot-testing 
* Identify wanted branch point and seek to it:
	-> cd u-boot-testing
	-> cg-seek 024447b186cca55c2d803ab96b4c8f8674363b86
* Apply patch

Now how to proceed?

I can add  new  files  created  by  the  patch  using  "cg-add",  but
cg-status  says  "Changes recording BLOCKED: seeked from master", and
cg-commit says "committing blocked: seeked from master", too.

However, when I now seek back I get this:

	-> cg-seek
	Warning: uncommitted local changes, trying to bring them along

which then results in a couple of conflicts which are probably to  be
expected.



So I tried this (after throwing away and re-creating my cloned repo):

* Uncommit the commit following the one I want to keep:
	-> cg-admin-uncommit 342717f72a2f92a14b9c823546e5bcec244f8bf4
	-> cg-reset
* cg-status reports a couple of unknown files (those added later to
  the tree); I manually removed these
* Apply patch
* Check in modifications
* Clone another tree
	-> cg-clone /git/u-boot u-boot-test-merge
	-> cd u-boot-test-merge
* Create branch for the stuff to be tested
	-> cg-branch-add testing-NAND /work/u-boot-testing
* Pull and merge:
	-> cg-pull testing-NAND
	-> cg-merge testing-NAND


This works as intended, but seems to be a bit  circuitous  to  me;  I
think this is probably a pretty common situation and there might be a
simpler approach which I am missing?

[If possible I'd like to use cogito only, but if there  is  a  clever
way to do this using git-core commands I'm interested, too.]


Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
The price of curiosity is a terminal experience.
                         - Terry Pratchett, _The Dark Side of the Sun_

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: (cogito) Branch offf from older commit?
  2005-08-14 15:50 (cogito) Branch offf from older commit? Wolfgang Denk
@ 2005-08-14 17:03 ` Linus Torvalds
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Torvalds @ 2005-08-14 17:03 UTC (permalink / raw
  To: Wolfgang Denk; +Cc: git



On Sun, 14 Aug 2005, Wolfgang Denk wrote:
>
> Is there (in cogito) a way to  start  a  branch  off  from  an  older
> commit?

You should be able to just use the git commands, and cogito should be 
perfectly happy.

IOW, if you do

	git checkout -b newbranch <starting-point-sha1>

you'll switch to a "newbranch" that was created at the starting point, and
as far as I can tell, this is all very cogito-friendly indeed. So now you
can work in that "newbranch" - commit things, do anything you want, and
all with cogito (ie it's only this one raw git command you need to set
things up, after that you're back in cogito-land).

You can switch back with "git checkout master" (again, I don't think
cogito does the local git branches yet, but once you've switched back
you're golden), and if you're in the "master" branch, you can merge with 
your new-branch with


	git resolve master newbranch "Merge my work on xyz"

or similar.

And always remember "gitk --all", since that's a very useful thing to 
visualize where you are.

> 	-> cg-seek 024447b186cca55c2d803ab96b4c8f8674363b86

No, cg-seek doesn't start a new branch, so the result is "locked". You 
can't commit on top of the seek-point, because the branch you are in 
already _has_ a child of that point.

(Actually, these days cg-seek does use a fixed local git branch for the
seek target, so that's not _technically_ true any more. I suspect Pasky is 
working on exposing the general local branch interfaces)

		Linus

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-08-14 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-14 15:50 (cogito) Branch offf from older commit? Wolfgang Denk
2005-08-14 17:03 ` Linus Torvalds

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).