git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Larry D'Anna <larry@elder-gods.org>
To: git@vger.kernel.org
Subject: RFC: git sync
Date: Tue, 9 Feb 2010 22:27:20 -0500	[thread overview]
Message-ID: <20100210032720.GA5205@cthulhu> (raw)

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

             reply	other threads:[~2010-02-10  3:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-10  3:27 Larry D'Anna [this message]
2010-02-10  9:52 ` RFC: git sync Jakub Narebski
2010-02-10 16:39   ` Sergio
2010-02-10 19:47   ` Larry D'Anna

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100210032720.GA5205@cthulhu \
    --to=larry@elder-gods.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).