git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* RFC: git sync
@ 2010-02-10  3:27 Larry D'Anna
  2010-02-10  9:52 ` Jakub Narebski
  0 siblings, 1 reply; 4+ messages in thread
From: Larry D'Anna @ 2010-02-10  3:27 UTC (permalink / raw)
  To: git

So say you have a project with a bunch of branches.  You have two main computers
you work on: a laptop and a workstation, and you keep an authoritative copy on a
server somewhere.  When you sit down at your laptop to work on your project, the
first thing you want to do is make sure that whatever you've got locally is
up-to-date with the repo on the server.  So you run: 

git push origin :

Then if it says anything isn't a fast-forward, you use some combination of git
pull, git checkout, or git fetch to get all you branches up to date, then
possibly you run the push again to push merges back to the server.

How about instead we add a new command called "git sync" that does all that for
you?  So if you say 

git sync origin : 

It matches refs just like git-push would, but it will also automatically
fast-forward your local refs if possible.  (and update the worktree+index if
HEAD is one of the local refs that gets fast forwarded).  If any merges would
be required, it will print a warning and leave that ref alone.

And if you say

git sync --merge origin :

it will try to merge any refs that need it.  If the merge succeeds, it will be
exactly as if you had said

git checkout foobranch
git pull origin foobranch
git push origin foobranch

What do you all think?  If you like the idea, I'll do it as a builtin.
Otherwise I'll just hack up a perl script for myself.


          --larry

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

* Re: RFC: git sync
  2010-02-10  3:27 RFC: git sync Larry D'Anna
@ 2010-02-10  9:52 ` Jakub Narebski
  2010-02-10 16:39   ` Sergio
  2010-02-10 19:47   ` Larry D'Anna
  0 siblings, 2 replies; 4+ messages in thread
From: Jakub Narebski @ 2010-02-10  9:52 UTC (permalink / raw)
  To: Larry D'Anna; +Cc: git

Larry D'Anna <larry@elder-gods.org> writes:

> So say you have a project with a bunch of branches.  You have two main computers
> you work on: a laptop and a workstation, and you keep an authoritative copy on a
> server somewhere.  When you sit down at your laptop to work on your project, the
> first thing you want to do is make sure that whatever you've got locally is
> up-to-date with the repo on the server.  So you run: 
> 
> git push origin :
> 
> Then if it says anything isn't a fast-forward, you use some combination of git
> pull, git checkout, or git fetch to get all you branches up to date, then
> possibly you run the push again to push merges back to the server.
> 
> How about instead we add a new command called "git sync" that does all that for
> you?  So if you say 
> 
> git sync origin : 

[...]
> What do you all think?  If you like the idea, I'll do it as a builtin.
> Otherwise I'll just hack up a perl script for myself.

Why not use the recpie from GitFaq:
"How would I use "git push" to sync out of a host that I cannot pull from?"
http://git.wiki.kernel.org/index.php/GitFaq#How_would_I_use_.22git_push.22_to_sync_out_of_a_host_that_I_cannot_pull_from.3F

-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Re: RFC: git sync
  2010-02-10  9:52 ` Jakub Narebski
@ 2010-02-10 16:39   ` Sergio
  2010-02-10 19:47   ` Larry D'Anna
  1 sibling, 0 replies; 4+ messages in thread
From: Sergio @ 2010-02-10 16:39 UTC (permalink / raw)
  To: git

> Why not use the recpie from GitFaq:
> "How would I use "git push" to sync out of a host that I cannot pull from?"
>
http://git.wiki.kernel.org/index.php/GitFaq#How_would_I_use_.22git_push.22_to_sync_out_of_a_host_that_I_cannot_pull_from.3F
> 

Hi, to follow that recipe with more than one satellite, all sharing the same
config, it would be just great to be able to put $hostname in .git-config, e.g.

[remote "mothership"]
   url = <url>
   push = master:refs/remotes/$hostname/master

Would there be any potential problem with that?

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

* Re: RFC: git sync
  2010-02-10  9:52 ` Jakub Narebski
  2010-02-10 16:39   ` Sergio
@ 2010-02-10 19:47   ` Larry D'Anna
  1 sibling, 0 replies; 4+ messages in thread
From: Larry D'Anna @ 2010-02-10 19:47 UTC (permalink / raw)
  To: Jakub Narebski; +Cc: git

* Jakub Narebski (jnareb@gmail.com) [100210 04:53]:
> Why not use the recpie from GitFaq:
> "How would I use "git push" to sync out of a host that I cannot pull from?"
> http://git.wiki.kernel.org/index.php/GitFaq#How_would_I_use_.22git_push.22_to_sync_out_of_a_host_that_I_cannot_pull_from.3F

Because that has nothing whatsoever to do with the problem I'm trying to solve.

I'm trying to make a common task more automated and convenient.  It's not like I
don't know how to perform it manually.

      --larry

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

end of thread, other threads:[~2010-02-10 19:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-10  3:27 RFC: git sync Larry D'Anna
2010-02-10  9:52 ` Jakub Narebski
2010-02-10 16:39   ` Sergio
2010-02-10 19:47   ` Larry D'Anna

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