git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jay Soffian <jaysoffian@gmail.com>
To: John Dlugosz <JDlugosz@tradestation.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>
Subject: Re: fetch and pull
Date: Mon, 16 Mar 2009 18:14:48 -0400	[thread overview]
Message-ID: <76718490903161514ubbdc948o1a0251212fe65fea@mail.gmail.com> (raw)
In-Reply-To: <450196A1AAAE4B42A00A8B27A59278E70A2AF023@EXCHANGE.trad.tradestation.com>

On Mon, Mar 16, 2009 at 4:39 PM, John Dlugosz <JDlugosz@tradestation.com> wrote:
> Yes, I do.  If the central repository changed dev in some way other than a fast-forward, or if you really messed up your local dev, it still needs to be repointed.
>
> Remember the overall flow:  first fetch (not pull) and then inspect the difference between your dev and origin/dev.  Then, change your dev to match.

Let me illustrate why this is still probably wrong. I have a clone of
git://git.kernel.org/pub/scm/git/git.git. It has the following remote
tracking branches:

$ git branch -r
  origin/html
  origin/maint
  origin/man
  origin/master
  origin/next
  origin/pu
  origin/todo

origin/master is never reset. origin/pu resets often. When I want to
work on git, I typically create a branch from origin/master. In this
case, I would almost never want to reset that branch. So I'd typically
do:

$ git checkout -b topic origin/master
$ edit, commit, edit, commit...
$ git fetch
$ git log origin/master..topic
$ git rebase origin/master

Rarely, I'll base a topic on origin/pu. And origin/pu might get reset.
But even if it were, I wouldn't want to blindly reset my local branch
to match, thus losing my local changes. Instead I'd do this:

$ git checkout -b pu-topic origin/pu
$ git tag pu-topic-base # handy when origin/pu is reset
$ edit, commit, edit, commit
$ git fetch
drat, origin/pu was reset
$ git rebase --onto origin/pu pu-topic-base

And in the rare circumstance that I really do want to reset a local
branch, I'd do this:

$ git checkout dev
examine, make sure I really want to reset
$ git reset --hard origin/dev

I can't really think of a good reason I'd want to reset a local branch
which I haven't checked out.

j.

  parent reply	other threads:[~2009-03-16 22:16 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AcmmaYOKDtJohyDSQt2B3xvVeIPNPw==>
2009-03-16 19:00 ` fetch and pull John Dlugosz
2009-03-16 20:03   ` Jay Soffian
2009-03-16 20:39     ` John Dlugosz
2009-03-16 20:43       ` Sverre Rabbelier
2009-03-17  8:34         ` Jeff King
2009-03-17  8:36           ` Sverre Rabbelier
2009-03-16 22:14       ` Jay Soffian [this message]
2009-03-16 22:33         ` John Dlugosz
2009-03-17  0:09           ` Jay Soffian
2009-03-17 14:58             ` John Dlugosz
2009-03-17 16:21               ` Jay Soffian
2009-03-17 16:44                 ` John Dlugosz
2009-03-17 21:31                   ` Nanako Shiraishi
2009-03-18  8:58                     ` Björn Steinbrink
2009-03-18  9:37                       ` Junio C Hamano
2009-03-18 15:18                       ` John Dlugosz
2009-03-18 15:31                         ` Björn Steinbrink
2009-03-18 16:50                           ` John Dlugosz
2009-03-18  0:37                   ` Jeff King
2009-03-06 19:04 John Dlugosz
2009-03-06 19:27 ` Junio C Hamano
2009-03-06 20:44 ` Jakub Narebski
2009-03-06 20:49   ` Junio C Hamano
2009-03-06 22:11     ` John Dlugosz
2009-03-06 22:21       ` Junio C Hamano
2009-03-07  8:00       ` Bryan Donlan
2009-03-07 20:15         ` Junio C Hamano
2009-03-09 15:27           ` John Dlugosz
2009-03-09 15:08         ` John Dlugosz

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=76718490903161514ubbdc948o1a0251212fe65fea@mail.gmail.com \
    --to=jaysoffian@gmail.com \
    --cc=JDlugosz@tradestation.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).