git usage: my helper file is on another branch

3 views
Skip to first unread message

josef...@gmail.com

unread,
Jun 10, 2012, 9:01:27 AM6/10/12
to pystatsmodels
I don't know if there is an uncomplicated solution, but I ask anyway.

I got used to creating many different branches and work on issues and
topics in separate branches.
However, I ran now several times into the problem, that a file that I
want to use is on a different branch.

For example, I wanted to fix a bug in my Rtopy file, but it's not
available in the branch I'm working on.
(In this case, R still has the original in memory, and I was
maintaining a version outside the source tree, but that's outdated.)

Are there any recommendations? Is anyone running into this problem,
and has some tricks?

Josef

Ralf Gommers

unread,
Jun 10, 2012, 9:10:26 AM6/10/12
to pystat...@googlegroups.com
On Sun, Jun 10, 2012 at 3:01 PM, <josef...@gmail.com> wrote:
I don't know if there is an uncomplicated solution, but I ask anyway.

I got used to creating many different branches and work on issues and
topics in separate branches.
However, I ran now several times into the problem, that a file that I
want to use is on a different branch.

If by "use" you mean in combination with stuff in your current branch, maybe the topics/issues aren't really separate. If you mean that you just figured out how to fix something in an unrelated branch:

$ git stash  # saves current uncommitted stuff for later
$ git co other-branch
<make your fix and commit it
$ git co original-branch
$ git stash apply

Ralf


Yaroslav Halchenko

unread,
Jun 10, 2012, 10:19:06 PM6/10/12
to pystatsmodels
if I got a problem right this might be a partial solution .... git comes
with a handy (especially for bzr people ;) ) script, on Debian systems
available under

/usr/share/doc/git/contrib/workdir/git-new-workdir

then you could create multiple local checkouts of different branches in
different directories, e.g.

/usr/share/doc/git/contrib/workdir/git-new-workdir proj proj-featbranch
cd proj-featbranch
git checkout featbranch

and then both proj and proj-featbranch still access the same .git... so
you could use tools available e.g. only in proj-featbranch while working
on proj from that directory without switching branches within a single
'proj' directory
--
Yaroslav O. Halchenko
Postdoctoral Fellow, Department of Psychological and Brain Sciences
Dartmouth College, 419 Moore Hall, Hinman Box 6207, Hanover, NH 03755
Phone: +1 (603) 646-9834 Fax: +1 (603) 646-1419
WWW: http://www.linkedin.com/in/yarik
Reply all
Reply to author
Forward
0 new messages