git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Newbie: Branch management
@ 2009-07-22 20:41 Dr. Jennifer Nussbaum
  2009-07-22 21:45 ` Allan Kelly
  2009-07-23  5:39 ` Tim Harper
  0 siblings, 2 replies; 4+ messages in thread
From: Dr. Jennifer Nussbaum @ 2009-07-22 20:41 UTC (permalink / raw)
  To: git


Hi,

I hope its OK to ask basic questions on this list.

Im a recent convert to git and having trouble with branches. I mostly work on projects by myself, and what I want is that all branches of everything Im doing are in sync everywhere.

I have a remote repository on my production server that serves as the "main" repository. Then i work on projects on a number of different computers--my main home computer, my main work machine, several non-main computers :-) ... 

I've found it very confusing dealing with branches in this environment. If I have my "master" branch, and decide that i want a "refactoring-templates" branch, what Id *like* to do is create that branch, work on it, commit it, and when I say "git push" I want everything that's new on that computer to be synced to the "main" repository. And then when I get to the next computer, I want to be able to say "git pull" and have everything on that computer by synced *from* the "main" repository.

Instead I get confused by having to push branches separately, and it's confusing that when I do a pull it doesnt necessarily get other branches unless I specify them directly, and so on.

I've looked at the docs on branches and there's something i guess Im missing because this still seems very difficult. Can someone giving me advice on the best way to keep this kind of thing organized?

Thanks!

Jen


      

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

* Re: Newbie: Branch management
  2009-07-22 20:41 Newbie: Branch management Dr. Jennifer Nussbaum
@ 2009-07-22 21:45 ` Allan Kelly
  2009-07-23  3:15   ` Allen Johnson
  2009-07-23  5:39 ` Tim Harper
  1 sibling, 1 reply; 4+ messages in thread
From: Allan Kelly @ 2009-07-22 21:45 UTC (permalink / raw)
  To: Dr. Jennifer Nussbaum; +Cc: git

Hi Jennifer,

Like you I'm quite a new git user so I doubt I can entirely solve your
problem. However reading your mail, I recall my own initial confusion.
Like you, I maintain a main server and various work desktops.
Essentially I want my work status/environment replicated on-demand
around these desktops, with the server as the synch-point. Sounds like
you.

My observation is that the granularity of git which makes it very
malleable, is a problem when you want to do "broad brush" things like
this (and this is the typical Unix "feature-not-a-bug!"). So, I think
you need to write a few wee scripts as I have done.

I've set up very small scripts to execute a sequence of local and
ssh-based remote commands to sync things as I expect. For example,
'git add .;git commit -a -m "$MSG"; git push;' is fine but the files
in the origin server directory are out of sync for subsequent
processing & upload to the web site. This confused me a _lot_. So I
need 'ssh server_name "cd $SERVER_DIR && git checkout -f"'. Now the
server dir has the same content as my working dir.

I always call this script 'publish' and have an appropriate version in
the root of each of my working repos (the post-git compile/upload
stage differs). Then in vim I routinely execute ':./publish <project>
<commit msg> <upload Y/N>' from wherever I'm working.

If you want my (very simple!) 'publish' code then drop me a line. It
may give you a start.

HTH!

Cheers, al.

2009/7/22 Dr. Jennifer Nussbaum <bg271828@yahoo.com>:
>
> Hi,
>
> I hope its OK to ask basic questions on this list.
>
> Im a recent convert to git and having trouble with branches. I mostly work on projects by myself, and what I want is that all branches of everything Im doing are in sync everywhere.
>
> I have a remote repository on my production server that serves as the "main" repository. Then i work on projects on a number of different computers--my main home computer, my main work machine, several non-main computers :-) ...
>
> I've found it very confusing dealing with branches in this environment. If I have my "master" branch, and decide that i want a "refactoring-templates" branch, what Id *like* to do is create that branch, work on it, commit it, and when I say "git push" I want everything that's new on that computer to be synced to the "main" repository. And then when I get to the next computer, I want to be able to say "git pull" and have everything on that computer by synced *from* the "main" repository.
>
> Instead I get confused by having to push branches separately, and it's confusing that when I do a pull it doesnt necessarily get other branches unless I specify them directly, and so on.
>
> I've looked at the docs on branches and there's something i guess Im missing because this still seems very difficult. Can someone giving me advice on the best way to keep this kind of thing organized?
>
> Thanks!
>
> Jen
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: Newbie: Branch management
  2009-07-22 21:45 ` Allan Kelly
@ 2009-07-23  3:15   ` Allen Johnson
  0 siblings, 0 replies; 4+ messages in thread
From: Allen Johnson @ 2009-07-23  3:15 UTC (permalink / raw)
  To: Allan Kelly; +Cc: Dr. Jennifer Nussbaum, git

This might work as well. I'm assuming all repositories were cloned
directly from your central (master) repository. Pushing with the
following option should work for you:

$ git push --all

Assuming we are on the laptop repository:

$ git checkout -b laptopstuff
$ ... edit and commits ...
$ git push --all

That will push everything on your laptop repo to the central
repository. Then next time you pull from any of the other repositories
that were cloned from the central repository you'll see a remote
tracking branch for laptopstuff.

Assuming we are on the workstation now:

$ git pull
$ git branch -r

You should now see origin/laptopstuff in the list.

Hope that helps.

Allen

On Wed, Jul 22, 2009 at 5:45 PM, Allan Kelly<allankelly@gmail.com> wrote:
> Hi Jennifer,
>
> Like you I'm quite a new git user so I doubt I can entirely solve your
> problem. However reading your mail, I recall my own initial confusion.
> Like you, I maintain a main server and various work desktops.
> Essentially I want my work status/environment replicated on-demand
> around these desktops, with the server as the synch-point. Sounds like
> you.
>
> My observation is that the granularity of git which makes it very
> malleable, is a problem when you want to do "broad brush" things like
> this (and this is the typical Unix "feature-not-a-bug!"). So, I think
> you need to write a few wee scripts as I have done.
>
> I've set up very small scripts to execute a sequence of local and
> ssh-based remote commands to sync things as I expect. For example,
> 'git add .;git commit -a -m "$MSG"; git push;' is fine but the files
> in the origin server directory are out of sync for subsequent
> processing & upload to the web site. This confused me a _lot_. So I
> need 'ssh server_name "cd $SERVER_DIR && git checkout -f"'. Now the
> server dir has the same content as my working dir.
>
> I always call this script 'publish' and have an appropriate version in
> the root of each of my working repos (the post-git compile/upload
> stage differs). Then in vim I routinely execute ':./publish <project>
> <commit msg> <upload Y/N>' from wherever I'm working.
>
> If you want my (very simple!) 'publish' code then drop me a line. It
> may give you a start.
>
> HTH!
>
> Cheers, al.
>
> 2009/7/22 Dr. Jennifer Nussbaum <bg271828@yahoo.com>:
>>
>> Hi,
>>
>> I hope its OK to ask basic questions on this list.
>>
>> Im a recent convert to git and having trouble with branches. I mostly work on projects by myself, and what I want is that all branches of everything Im doing are in sync everywhere.
>>
>> I have a remote repository on my production server that serves as the "main" repository. Then i work on projects on a number of different computers--my main home computer, my main work machine, several non-main computers :-) ...
>>
>> I've found it very confusing dealing with branches in this environment. If I have my "master" branch, and decide that i want a "refactoring-templates" branch, what Id *like* to do is create that branch, work on it, commit it, and when I say "git push" I want everything that's new on that computer to be synced to the "main" repository. And then when I get to the next computer, I want to be able to say "git pull" and have everything on that computer by synced *from* the "main" repository.
>>
>> Instead I get confused by having to push branches separately, and it's confusing that when I do a pull it doesnt necessarily get other branches unless I specify them directly, and so on.
>>
>> I've looked at the docs on branches and there's something i guess Im missing because this still seems very difficult. Can someone giving me advice on the best way to keep this kind of thing organized?
>>
>> Thanks!
>>
>> Jen
>>
>>
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

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

* Re: Newbie: Branch management
  2009-07-22 20:41 Newbie: Branch management Dr. Jennifer Nussbaum
  2009-07-22 21:45 ` Allan Kelly
@ 2009-07-23  5:39 ` Tim Harper
  1 sibling, 0 replies; 4+ messages in thread
From: Tim Harper @ 2009-07-23  5:39 UTC (permalink / raw)
  To: Dr. Jennifer Nussbaum; +Cc: git

On Wed, Jul 22, 2009 at 2:41 PM, Dr. Jennifer
Nussbaum<bg271828@yahoo.com> wrote:
>
> Hi,
>
> I hope its OK to ask basic questions on this list.
>
> Im a recent convert to git and having trouble with branches. I mostly work on projects by myself, and what I want is that all branches of everything Im doing are in sync everywhere.
>
> I have a remote repository on my production server that serves as the "main" repository. Then i work on projects on a number of different computers--my main home computer, my main work machine, several non-main computers :-) ...
>
> I've found it very confusing dealing with branches in this environment. If I have my "master" branch, and decide that i want a "refactoring-templates" branch, what Id *like* to do is create that branch, work on it, commit it, and when I say "git push" I want everything that's new on that computer to be synced to the "main" repository. And then when I get to the next computer, I want to be able to say "git pull" and have everything on that computer by synced *from* the "main" repository.
>
> Instead I get confused by having to push branches separately, and it's confusing that when I do a pull it doesnt necessarily get other branches unless I specify them directly, and so on.
>
> I've looked at the docs on branches and there's something i guess Im missing because this still seems very difficult. Can someone giving me advice on the best way to keep this kind of thing organized?
>
> Thanks!
>
> Jen

I was turned off about this at first when I used git - I was in SVN
mode still and wanted all my local branches to be synchronized with
the remote repository.  A year and a half later, I'm glad that the
minds behind git didn't set out to make git like SVN!  I really think
this was the right decision.  For instance... if you pulled ALL of
your branches in one command... what if there were conflicts?  I doubt
you'd want to resolve them right then and there.

Anyways... 'git fetch' will download all the changes from the remote
repository.  From there, you can simply merge any remote branch
locally (ie, 'git merge origin/master' while in the master branch).

Enjoy the journey!

Tim

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

end of thread, other threads:[~2009-07-23  5:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-22 20:41 Newbie: Branch management Dr. Jennifer Nussbaum
2009-07-22 21:45 ` Allan Kelly
2009-07-23  3:15   ` Allen Johnson
2009-07-23  5:39 ` Tim Harper

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).