[git-users] Re: getting a list of branches

2010-08-24 Thread Ted
I don't seem to have one of those.  I guess I could just use the
contents of `.git/refs/heads`, but it would be better to use an API of
some sort than to rely on git's internal file structure.  Though that
does seem to be git's API in some cases, so maybe it's okay?  How to
know?

Cheers
-Ted

On Aug 24, 4:03 pm, Konstantin Khomoutov khomou...@gmail.com wrote:
 On Aug 24, 10:24 pm, Ted cecinemapasdera...@gmail.com wrote: Is there some 
 way to specifically get a list of branches, without the
  annotation that `git branch` normally adds?  I'd like to write a
  script that loops over branches, but it shouldn't be dependent on the
  presentation format.

 It appears that you could parse the .git/info/refs file.

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.



[git-users] Merging to a branch without checking it out

2010-03-20 Thread Ted
This is an attempt at a continuation of an earlier thread:
http://groups.google.com/group/git-users/browse_thread/thread/74460270aaa2bfb2

I would have replied to that thread but I didn't see an option to,
maybe because I'm a new member.

I'm using git to keep track of various scripts and configuration files
in my home directory; this system is in use on more than one machine.
Because of the varying availability of packages etc on the different
machines, some things need to be done a bit differently.  Although it
would be possible to set this up to happen using configuration
variables etc., I'd like to do it by having a different branch of the
'common' branch for each machine.

However it's a bit tricky, because although in general most commits
will be being merged back to the common branch, the working tree needs
to stay on the machine-specific branch, because it's effectively a
production system.  So if we do it the normal way we end up with
something like this drawing, which you may have to cut-and-paste
somewhere to see actually line up:

  machine1A--B--C
 /   \
  commonA-C

Here we have the machine1 branch being branched off of common at A.
Commit B is something that's specific to machine1, and shouldn't ever
go to common.
At commit C we want to make a commit directly to common, but we can't.
Then it gets merged back into common with the changes from commit B
included, which is not what we want.

  machine1A--BC
 /   /
  commonA---D

In this version we end up with common's HEAD at D, which is the
changes from C without the changes from B.  machine1 ends up the same
after the merge.

The only problem is that there's not an obvious way to create this
history without cloning the repo or switching branches.   Since there
is likely at any point in time to be a mix of changes destined for
machine1 and common, stashing wouldn't necessarily provide a solution,
and that would still require switching branches.  I'd like to be able
to use the index and just commit the index contents to a different
branch than the one that's checked out.

The earlier thread referenced above mentioned that it would likely be
possible to do something like this using plumbing commands.  I'm
hoping for some direction towards figuring out how to do so.

Thanks

-- 
You received this message because you are subscribed to the Google Groups Git 
for human beings group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
git-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/git-users?hl=en.