[PATCH] Re: push: point to 'git pull' and 'git push --force' in case of non-fast forward
- From
- Nicolas Sebrecht <nicolas.s.dev@gmx.fr>
- Date
- Aug 6, 2009, 21:16 UTC
- Message-ID
- <20090806211610.GB12924@vidovic>
- In-Reply-To
- <7v7hxgk8c9.fsf@alter.siamese.dyndns.org>
The 06/08/09, Junio C Hamano wrote:
Show 23 quoted lines
> Documentation/git-push.txt | 75 ++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 75 insertions(+), 0 deletions(-) > > diff --git a/Documentation/git-push.txt b/Documentation/git-push.txt > index 2653388..c1ae82d 100644 > --- a/Documentation/git-push.txt > +++ b/Documentation/git-push.txt > @@ -195,6 +195,81 @@ reason:: > refs, no explanation is needed. For a failed ref, the reason for > failure is described. > > +Note about fast-forwards > +------------------------ > + > +When an update changes a branch (or more in general, a ref) that used to > +point at commit A to point at another commit B, it is called a > +fast-forward update if and only if B is a descendant of A. > + > +In a fast-forward update from A to B, the set of commits that the original > +commit A built on top of is a subset of the commits the new commit B > +builds on top of. Hence, it does not lose any history. > + > +In contrast, a non-fast-forward update will lose history.
I believe that this sentence a bit too much scaring for the beginner. There are two kinds of update (push and pull). We loose history only when pushing. I know this applies to Documentation/git-push.txt but out of this context (and because we talk about pull near from here), I think it would be clearer to say something like:
In contrast, a non-fast-forward push will loose history.
Show 12 quoted lines
> For example, > +suppose you and somebody else started at the same commit X, and you built > +a history leading to commit B while the other person built a history > +leading to commit A. The history looks like this: > + > +---------------- > + > + B > + / > + ---X---A > + > +----------------
<...>
Show 12 quoted lines
> +Alternatively, you can rebase your change between X and B on top of A, > +with "git pull --rebase", and push the result back. The rebase will > +create a new commit D that builds the change between X and B on top of > +A. > + > +---------------- > + > + B D > + / / > + ---X---A > + > +----------------
Wouldn't "git pull --rebase" loose B? Shouldn't we have this
----------------
D
/
---X---A
----------------instead?
-- Nicolas Sebrecht