Skip to content

Commit 6ffd781

Browse files
committed
Merge branch 'maint'
* maint: push: point to 'git pull' and 'git push --force' in case of non-fast forward Documentation: add: <filepattern>... is optional Change mentions of "git programs" to "git commands" Documentation: merge: one <remote> is required help.c: give correct structure's size to memset()
2 parents 19a7fcb + 2cd9c2a commit 6ffd781

14 files changed

+117
-18
lines changed

Documentation/config.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ color.interactive.<slot>::
605605
Use customized color for 'git-add --interactive'
606606
output. `<slot>` may be `prompt`, `header`, `help` or `error`, for
607607
four distinct types of normal output from interactive
608-
programs. The values of these variables may be specified as
608+
commands. The values of these variables may be specified as
609609
in color.branch.<slot>.
610610

611611
color.pager::
@@ -1113,7 +1113,7 @@ instaweb.port::
11131113
linkgit:git-instaweb[1].
11141114

11151115
interactive.singlekey::
1116-
In interactive programs, allow the user to provide one-letter
1116+
In interactive commands, allow the user to provide one-letter
11171117
input with a single key (i.e., without hitting enter).
11181118
Currently this is used only by the `\--patch` mode of
11191119
linkgit:git-add[1]. Note that this setting is silently

Documentation/fetch-options.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
-q::
22
--quiet::
33
Pass --quiet to git-fetch-pack and silence any other internally
4-
used programs.
4+
used git commands.
55

66
-v::
77
--verbose::

Documentation/git-add.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SYNOPSIS
1010
[verse]
1111
'git add' [-n] [-v] [--force | -f] [--interactive | -i] [--patch | -p]
1212
[--edit | -e] [--all | [--update | -u]] [--intent-to-add | -N]
13-
[--refresh] [--ignore-errors] [--] <filepattern>...
13+
[--refresh] [--ignore-errors] [--] [<filepattern>...]
1414

1515
DESCRIPTION
1616
-----------

Documentation/git-merge.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ SYNOPSIS
1010
--------
1111
[verse]
1212
'git merge' [-n] [--stat] [--no-commit] [--squash] [-s <strategy>]...
13-
[-m <msg>] <remote> <remote>...
13+
[-m <msg>] <remote>...
1414
'git merge' <msg> HEAD <remote>...
1515

1616
DESCRIPTION

Documentation/git-push.txt

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,92 @@ reason::
195195
refs, no explanation is needed. For a failed ref, the reason for
196196
failure is described.
197197

198+
Note about fast-forwards
199+
------------------------
200+
201+
When an update changes a branch (or more in general, a ref) that used to
202+
point at commit A to point at another commit B, it is called a
203+
fast-forward update if and only if B is a descendant of A.
204+
205+
In a fast-forward update from A to B, the set of commits that the original
206+
commit A built on top of is a subset of the commits the new commit B
207+
builds on top of. Hence, it does not lose any history.
208+
209+
In contrast, a non-fast-forward update will lose history. For example,
210+
suppose you and somebody else started at the same commit X, and you built
211+
a history leading to commit B while the other person built a history
212+
leading to commit A. The history looks like this:
213+
214+
----------------
215+
216+
B
217+
/
218+
---X---A
219+
220+
----------------
221+
222+
Further suppose that the other person already pushed changes leading to A
223+
back to the original repository you two obtained the original commit X.
224+
225+
The push done by the other person updated the branch that used to point at
226+
commit X to point at commit A. It is a fast-forward.
227+
228+
But if you try to push, you will attempt to update the branch (that
229+
now points at A) with commit B. This does _not_ fast-forward. If you did
230+
so, the changes introduced by commit A will be lost, because everybody
231+
will now start building on top of B.
232+
233+
The command by default does not allow an update that is not a fast-forward
234+
to prevent such loss of history.
235+
236+
If you do not want to lose your work (history from X to B) nor the work by
237+
the other person (history from X to A), you would need to first fetch the
238+
history from the repository, create a history that contains changes done
239+
by both parties, and push the result back.
240+
241+
You can perform "git pull", resolve potential conflicts, and "git push"
242+
the result. A "git pull" will create a merge commit C between commits A
243+
and B.
244+
245+
----------------
246+
247+
B---C
248+
/ /
249+
---X---A
250+
251+
----------------
252+
253+
Updating A with the resulting merge commit will fast-forward and your
254+
push will be accepted.
255+
256+
Alternatively, you can rebase your change between X and B on top of A,
257+
with "git pull --rebase", and push the result back. The rebase will
258+
create a new commit D that builds the change between X and B on top of
259+
A.
260+
261+
----------------
262+
263+
B D
264+
/ /
265+
---X---A
266+
267+
----------------
268+
269+
Again, updating A with this commit will fast-forward and your push will be
270+
accepted.
271+
272+
There is another common situation where you may encounter non-fast-forward
273+
rejection when you try to push, and it is possible even when you are
274+
pushing into a repository nobody else pushes into. After you push commit
275+
A yourself (in the first picture in this section), replace it with "git
276+
commit --amend" to produce commit B, and you try to push it out, because
277+
forgot that you have pushed A out already. In such a case, and only if
278+
you are certain that nobody in the meantime fetched your earlier commit A
279+
(and started building on top of it), you can run "git push --force" to
280+
overwrite it. In other words, "git push --force" is a method reserved for
281+
a case where you do mean to lose history.
282+
283+
198284
Examples
199285
--------
200286

Documentation/git-rev-list.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ between the two operands. The following two commands are equivalent:
9090
$ git rev-list A...B
9191
-----------------------------------------------------------------------
9292

93-
'git-rev-list' is a very essential git program, since it
93+
'rev-list' is a very essential git command, since it
9494
provides the ability to build and traverse commit ancestry graphs. For
9595
this reason, it has a lot of different options that enables it to be
9696
used by commands as different as 'git-bisect' and

Documentation/git.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ Synching repositories
327327

328328
include::cmds-synchingrepositories.txt[]
329329

330-
The following are helper programs used by the above; end users
330+
The following are helper commands used by the above; end users
331331
typically do not use them directly.
332332

333333
include::cmds-synchelpers.txt[]

Documentation/gitattributes.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ Performing a three-way merge
404404

405405
The attribute `merge` affects how three versions of a file is
406406
merged when a file-level merge is necessary during `git merge`,
407-
and other programs such as `git revert` and `git cherry-pick`.
407+
and other commands such as `git revert` and `git cherry-pick`.
408408

409409
Set::
410410

Documentation/gitcore-tutorial.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ git *
1212
DESCRIPTION
1313
-----------
1414

15-
This tutorial explains how to use the "core" git programs to set up and
15+
This tutorial explains how to use the "core" git commands to set up and
1616
work with a git repository.
1717

1818
If you just need to use git as a revision control system you may prefer
@@ -1328,7 +1328,7 @@ into it later. Obviously, this repository creation needs to be
13281328
done only once.
13291329

13301330
[NOTE]
1331-
'git-push' uses a pair of programs,
1331+
'git-push' uses a pair of commands,
13321332
'git-send-pack' on your local machine, and 'git-receive-pack'
13331333
on the remote machine. The communication between the two over
13341334
the network internally uses an SSH connection.

Documentation/user-manual.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4131,7 +4131,7 @@ What does this mean?
41314131

41324132
`git rev-list` is the original version of the revision walker, which
41334133
_always_ printed a list of revisions to stdout. It is still functional,
4134-
and needs to, since most new Git programs start out as scripts using
4134+
and needs to, since most new Git commands start out as scripts using
41354135
`git rev-list`.
41364136

41374137
`git rev-parse` is not as important any more; it was only used to filter out

0 commit comments

Comments
 (0)