git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Narebski <jnareb@fuw.edu.pl>
To: memcached@lists.danga.com
Cc: git@vger.kernel.org
Subject: Re: Upcoming memcached releases + rambling.
Date: 11 Feb 2008 13:50:53 +0100	[thread overview]
Message-ID: <m33arzfyhe.fsf@localhost.localdomain> (raw)
In-Reply-To: 20080210094753.23234.qmail@science.horizon.com

"George Spelvin" <linux@horizon.com> writes:

> A few notes about git that may be causing confusion:
> 
> 1) "git pull" does more than you think, and is for developers only.
> 
>    To just follow some other work, use only "git fetch".
> 
>    "git pull" does a fetch, and then merges the fetched branch into your
>    current HEAD.  If your current HEAD is a copy of the remote branch,
>    this will be harmless, but if it's not, it will produce code changes.

Note that "git fetch" usually fetches multiple branches; with default
configuration it fetches _all_ the branches. "git pull" would merge
the one marked for merge into current branch (HEAD is current branch),
either the one marked explicitely, or the first/main branch.
 
>    "git fetch" will fetch the remote branch, and then do a "fast-forward"
>    update of the corresponding local tracking branch.  If the local
>    tracking branch is not an ancestor of the fetched branch, it will
>    abort with an error.

But you can force fetching even if branch(es) in remote repository are
not ancestors of local tracking branches, which is needed if tracked
branch is rewound, reforked or rebased. Moreover by default this check
is disabled: all fetches are "forced".

You can always go to the previous value of branch thanks to reflogs,
so it is not really less safe, and avoids some hassle.

>    So, in summary, don't use "pull" unless you want to do a merge.
>    It will suppress the merge in the obvious trivial cases (no changes
>    on one side or the other), but will happily combine things.
> 
>    (The reason that "pull" is such a prominent command is that it's what
>    Linus does all day: merges other people's development into his tree.)

BTW. with newest git "git pull" _can_ rebase instead of merge.

> 2) "git log old..new" is a special case of a very general mechanism
>    for specifying a set of commits to examine.

>    The syntax is "include1 include2 ^exclude1 ^exclude2 include3...".

>    There is one magic bit of syntax, the symmetric difference operator
>    "rev1...rev2" (note three dots).  That means all ancestors of rev1,
>    and all ancestors of rev2, but excluding all common ancestors of both.
>    It's also equivalent to an include-exclude list, but the computation
>    of the exclude set is a bit more complicated.  (It's usually just
>    one common ancestor, but there can be multiples in nasty criss-cross
>    merge cases.)

"rev1...rev2" is equivalent to "rev1 rev2 --not $(git merge-base rev1 rev2)"
which I think explains what it does.
 
> 3) "git diff old..new" uses the same syntax for a different purpose.
>    diff only works with two commits, so that's simply an alias for
>    "git diff old new".  (Whether this is a useful conveience or is too
>    misleading for the beginner has been the subject of heated discussion
>    on the git mailing list.)

By the way, "git diff rev1...rev2" also works, and shows diff between
rev2 and common ancestor of rev1 and rev2 (merge base).

-- 
Jakub Narebski
Poland
ShadeHawk on #git

  reply	other threads:[~2008-02-11 12:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-10  9:47 Upcoming memcached releases + rambling George Spelvin
2008-02-11 12:50 ` Jakub Narebski [this message]
     [not found] <47AAC7DA.2010604@rydia.net>
     [not found] ` <4422C0B2-6874-41EA-B4A0-4F3414F385FC@spy.net>
     [not found]   ` <47AB3DBD.60004@rydia.net>
     [not found]     ` <3897B3FD-4DCB-4150-8A07-7F8868A70A93@spy.net>
     [not found]       ` <47AD2D1F.7030807@rydia.net>
     [not found]         ` <5222C3B4-5E2C-45D2-8DF3-A85D69DDA2CF@spy.net>
2008-02-10 11:05           ` Jeff King
2008-02-10 15:14             ` Jakub Narebski
2008-02-10 15:39               ` Jakub Narebski
     [not found]           ` <47AD643D.3040800@rydia.net>
2008-02-10 11:15             ` Jeff King

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=m33arzfyhe.fsf@localhost.localdomain \
    --to=jnareb@fuw.edu.pl \
    --cc=git@vger.kernel.org \
    --cc=memcached@lists.danga.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).