Skip to content

Commit 784b11c

Browse files
author
Junio C Hamano
committed
Merge branch 'maint'
* maint: GIT 1.5.0.3 glossary: Add definitions for dangling and unreachable objects user-manual: more detailed merge discussion user-manual: how to replace commits older than most recent user-manual: insert earlier of mention content-addressable architecture user-manual: ensure generated manual references stylesheet user-manual: reset to ORIG_HEAD not HEAD to undo merge Documentation: mention module option to git-cvsimport
2 parents 102a0a2 + 7193db3 commit 784b11c

File tree

5 files changed

+167
-48
lines changed

5 files changed

+167
-48
lines changed

Documentation/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,11 @@ clean:
105105
user-manual.xml: user-manual.txt user-manual.conf
106106
$(ASCIIDOC) -b docbook -d book $<
107107

108+
XSLT = http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl
109+
XSLTOPTS = --nonet --xinclude --stringparam html.stylesheet docbook-xsl.css
110+
108111
user-manual.html: user-manual.xml
109-
xmlto html-nochunks $<
112+
xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
110113

111114
glossary.html : glossary.txt sort_glossary.pl
112115
cat $< | \

Documentation/RelNotes-1.5.0.3.txt

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GIT v1.5.0.2 Release Notes
1+
GIT v1.5.0.3 Release Notes
22
==========================
33

44
Fixes since v1.5.0.2
@@ -15,6 +15,10 @@ Fixes since v1.5.0.2
1515
path. Earlier it started in the middle of the path, and
1616
incorrectly.
1717

18+
- 'git-merge' did not exit with non-zero status when the
19+
working tree was dirty and cannot fast forward. It does
20+
now.
21+
1822
- 'cvsexportcommit' does not lose yet-to-be-used message file.
1923

2024
- int-vs-size_t typefix when running combined diff on files
@@ -38,18 +42,17 @@ Fixes since v1.5.0.2
3842
- 'git index-pack' did not protect itself from getting a short
3943
read out of pread(2).
4044

45+
- 'git http-push' had a few buffer overruns.
46+
47+
- Build dependency fixes to rebuild fetch.o when other headers
48+
change.
49+
4150
* Documentation updates
4251

43-
- options to 'git remote add' were described insufficiently.
52+
- user-manual updates.
4453

54+
- Options to 'git remote add' were described insufficiently.
4555

46-
---
47-
exec >/var/tmp/1
48-
O=v1.5.0.2
49-
O=v1.5.0.2-16-gdb554bf
50-
echo O=`git describe maint`
51-
git shortlog --no-merges $O..maint
56+
- Configuration format.suffix was not documented.
5257

53-
# Local Variables:
54-
# mode: text
55-
# End:
58+
- Other formatting and spelling fixes.

Documentation/cvs-migration.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ sure it is in your path. Then cd to a checked out CVS working directory
109109
of the project you are interested in and run gitlink:git-cvsimport[1]:
110110

111111
-------------------------------------------
112-
$ git cvsimport -C <destination>
112+
$ git cvsimport -C <destination> <module>
113113
-------------------------------------------
114114

115115
This puts a git archive of the named CVS module in the directory

Documentation/glossary.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ DAG::
7373
objects is acyclic (there is no chain which begins and ends with the
7474
same object).
7575

76+
dangling object::
77+
An unreachable object which is not reachable even from other
78+
unreachable objects; a dangling object has no references to it
79+
from any reference or object in the repository.
80+
7681
dircache::
7782
You are *waaaaay* behind.
7883

@@ -350,6 +355,10 @@ tag::
350355
unmerged index::
351356
An index which contains unmerged index entries.
352357

358+
unreachable object::
359+
An object which is not reachable from a branch, tag, or any
360+
other reference.
361+
353362
working tree::
354363
The set of files and directories currently being worked on,
355364
i.e. you can work in your working tree without using git at all.

Documentation/user-manual.txt

Lines changed: 139 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -391,15 +391,20 @@ index 8be626f..d7aac9d 100644
391391
As you can see, a commit shows who made the latest change, what they
392392
did, and why.
393393

394-
Every commit has a 40-hexdigit id, sometimes called the "object name"
395-
or the "SHA1 id", shown on the first line of the "git show" output.
396-
You can usually refer to a commit by a shorter name, such as a tag or a
397-
branch name, but this longer name can also be useful. Most
398-
importantly, it is a globally unique name for this commit: so if you
399-
tell somebody else the object name (for example in email), then you are
400-
guaranteed that name will refer to the same commit in their repository
401-
that it does in yours (assuming their repository has that commit at
402-
all).
394+
Every commit has a 40-hexdigit id, sometimes called the "object name" or the
395+
"SHA1 id", shown on the first line of the "git show" output. You can usually
396+
refer to a commit by a shorter name, such as a tag or a branch name, but this
397+
longer name can also be useful. Most importantly, it is a globally unique
398+
name for this commit: so if you tell somebody else the object name (for
399+
example in email), then you are guaranteed that name will refer to the same
400+
commit in their repository that it does in yours (assuming their repository
401+
has that commit at all). Since the object name is computed as a hash over the
402+
contents of the commit, you are guaranteed that the commit can never change
403+
without its name also changing.
404+
405+
In fact, in <<git-internals>> we shall see that everything stored in git
406+
history, including file data and directory contents, is stored in an object
407+
with a name that is a hash of its contents.
403408

404409
Understanding history: commits, parents, and reachability
405410
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1163,18 +1168,46 @@ the working tree in a special state that gives you all the
11631168
information you need to help resolve the merge.
11641169

11651170
Files with conflicts are marked specially in the index, so until you
1166-
resolve the problem and update the index, git commit will fail:
1171+
resolve the problem and update the index, gitlink:git-commit[1] will
1172+
fail:
11671173

11681174
-------------------------------------------------
11691175
$ git commit
11701176
file.txt: needs merge
11711177
-------------------------------------------------
11721178

1173-
Also, git status will list those files as "unmerged".
1179+
Also, gitlink:git-status[1] will list those files as "unmerged", and the
1180+
files with conflicts will have conflict markers added, like this:
1181+
1182+
-------------------------------------------------
1183+
<<<<<<< HEAD:file.txt
1184+
Hello world
1185+
=======
1186+
Goodbye
1187+
>>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:file.txt
1188+
-------------------------------------------------
1189+
1190+
All you need to do is edit the files to resolve the conflicts, and then
1191+
1192+
-------------------------------------------------
1193+
$ git add file.txt
1194+
$ git commit
1195+
-------------------------------------------------
1196+
1197+
Note that the commit message will already be filled in for you with
1198+
some information about the merge. Normally you can just use this
1199+
default message unchanged, but you may add additional commentary of
1200+
your own if desired.
1201+
1202+
The above is all you need to know to resolve a simple merge. But git
1203+
also provides more information to help resolve conflicts:
1204+
1205+
Getting conflict-resolution help during a merge
1206+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
11741207

11751208
All of the changes that git was able to merge automatically are
11761209
already added to the index file, so gitlink:git-diff[1] shows only
1177-
the conflicts. Also, it uses a somewhat unusual syntax:
1210+
the conflicts. It uses an unusual syntax:
11781211

11791212
-------------------------------------------------
11801213
$ git diff
@@ -1195,14 +1228,32 @@ conflict will have two parents instead of the usual one: one parent
11951228
will be HEAD, the tip of the current branch; the other will be the
11961229
tip of the other branch, which is stored temporarily in MERGE_HEAD.
11971230

1198-
The diff above shows the differences between the working-tree version
1199-
of file.txt and two previous versions: one version from HEAD, and one
1200-
from MERGE_HEAD. So instead of preceding each line by a single "+"
1201-
or "-", it now uses two columns: the first column is used for
1202-
differences between the first parent and the working directory copy,
1203-
and the second for differences between the second parent and the
1204-
working directory copy. Thus after resolving the conflict in the
1205-
obvious way, the diff will look like:
1231+
During the merge, the index holds three versions of each file. Each of
1232+
these three "file stages" represents a different version of the file:
1233+
1234+
-------------------------------------------------
1235+
$ git show :1:file.txt # the file in a common ancestor of both branches
1236+
$ git show :2:file.txt # the version from HEAD, but including any
1237+
# nonconflicting changes from MERGE_HEAD
1238+
$ git show :3:file.txt # the version from MERGE_HEAD, but including any
1239+
# nonconflicting changes from HEAD.
1240+
-------------------------------------------------
1241+
1242+
Since the stage 2 and stage 3 versions have already been updated with
1243+
nonconflicting changes, the only remaining differences between them are
1244+
the important ones; thus gitlink:git-diff[1] can use the information in
1245+
the index to show only those conflicts.
1246+
1247+
The diff above shows the differences between the working-tree version of
1248+
file.txt and the stage 2 and stage 3 versions. So instead of preceding
1249+
each line by a single "+" or "-", it now uses two columns: the first
1250+
column is used for differences between the first parent and the working
1251+
directory copy, and the second for differences between the second parent
1252+
and the working directory copy. (See the "COMBINED DIFF FORMAT" section
1253+
of gitlink:git-diff-files[1] for a details of the format.)
1254+
1255+
After resolving the conflict in the obvious way (but before updating the
1256+
index), the diff will look like:
12061257

12071258
-------------------------------------------------
12081259
$ git diff
@@ -1220,26 +1271,37 @@ This shows that our resolved version deleted "Hello world" from the
12201271
first parent, deleted "Goodbye" from the second parent, and added
12211272
"Goodbye world", which was previously absent from both.
12221273

1223-
The gitlink:git-log[1] command also provides special help for merges:
1274+
Some special diff options allow diffing the working directory against
1275+
any of these stages:
1276+
1277+
-------------------------------------------------
1278+
$ git diff -1 file.txt # diff against stage 1
1279+
$ git diff --base file.txt # same as the above
1280+
$ git diff -2 file.txt # diff against stage 2
1281+
$ git diff --ours file.txt # same as the above
1282+
$ git diff -3 file.txt # diff against stage 3
1283+
$ git diff --theirs file.txt # same as the above.
1284+
-------------------------------------------------
1285+
1286+
The gitlink:git-log[1] and gitk[1] commands also provide special help
1287+
for merges:
12241288

12251289
-------------------------------------------------
12261290
$ git log --merge
1291+
$ gitk --merge
12271292
-------------------------------------------------
12281293

1229-
This will list all commits which exist only on HEAD or on MERGE_HEAD,
1230-
and which touch an unmerged file.
1294+
These will display all commits which exist only on HEAD or on
1295+
MERGE_HEAD, and which touch an unmerged file.
12311296

1232-
We can now add the resolved version to the index and commit:
1297+
Each time you resolve the conflicts in a file and update the index:
12331298

12341299
-------------------------------------------------
12351300
$ git add file.txt
1236-
$ git commit
12371301
-------------------------------------------------
12381302

1239-
Note that the commit message will already be filled in for you with
1240-
some information about the merge. Normally you can just use this
1241-
default message unchanged, but you may add additional commentary of
1242-
your own if desired.
1303+
the different stages of that file will be "collapsed", after which
1304+
git-diff will (by default) no longer show diffs for that file.
12431305

12441306
[[undoing-a-merge]]
12451307
undoing a merge
@@ -1255,7 +1317,7 @@ $ git reset --hard HEAD
12551317
Or, if you've already commited the merge that you want to throw away,
12561318

12571319
-------------------------------------------------
1258-
$ git reset --hard HEAD^
1320+
$ git reset --hard ORIG_HEAD
12591321
-------------------------------------------------
12601322

12611323
However, this last command can be dangerous in some cases--never
@@ -1328,6 +1390,7 @@ with the changes to be reverted, then you will be asked to fix
13281390
conflicts manually, just as in the case of <<resolving-a-merge,
13291391
resolving a merge>>.
13301392

1393+
[[fixing-a-mistake-by-editing-history]]
13311394
Fixing a mistake by editing history
13321395
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
13331396

@@ -1930,6 +1993,51 @@ return mywork to the state it had before you started the rebase:
19301993
$ git rebase --abort
19311994
-------------------------------------------------
19321995

1996+
Modifying a single commit
1997+
-------------------------
1998+
1999+
We saw in <<fixing-a-mistake-by-editing-history>> that you can replace the
2000+
most recent commit using
2001+
2002+
-------------------------------------------------
2003+
$ git commit --amend
2004+
-------------------------------------------------
2005+
2006+
which will replace the old commit by a new commit incorporating your
2007+
changes, giving you a chance to edit the old commit message first.
2008+
2009+
You can also use a combination of this and gitlink:git-rebase[1] to edit
2010+
commits further back in your history. First, tag the problematic commit with
2011+
2012+
-------------------------------------------------
2013+
$ git tag bad mywork~5
2014+
-------------------------------------------------
2015+
2016+
(Either gitk or git-log may be useful for finding the commit.)
2017+
2018+
Then check out a new branch at that commit, edit it, and rebase the rest of
2019+
the series on top of it:
2020+
2021+
-------------------------------------------------
2022+
$ git checkout -b TMP bad
2023+
$ # make changes here and update the index
2024+
$ git commit --amend
2025+
$ git rebase --onto TMP bad mywork
2026+
-------------------------------------------------
2027+
2028+
When you're done, you'll be left with mywork checked out, with the top patches
2029+
on mywork reapplied on top of the modified commit you created in TMP. You can
2030+
then clean up with
2031+
2032+
-------------------------------------------------
2033+
$ git branch -d TMP
2034+
$ git tag -d bad
2035+
-------------------------------------------------
2036+
2037+
Note that the immutable nature of git history means that you haven't really
2038+
"modified" existing commits; instead, you have replaced the old commits with
2039+
new commits having new object names.
2040+
19332041
Reordering or selecting from a patch series
19342042
-------------------------------------------
19352043

@@ -2155,6 +2263,7 @@ See gitlink:git-config[1] for more details on the configuration
21552263
options mentioned above.
21562264

21572265

2266+
[[git-internals]]
21582267
Git internals
21592268
=============
21602269

@@ -2936,11 +3045,6 @@ provides.
29363045
Simplify beginning by suggesting disconnected head instead of
29373046
temporary branch creation?
29383047

2939-
Explain how to refer to file stages in the "how to resolve a merge"
2940-
section: diff -1, -2, -3, --ours, --theirs :1:/path notation. The
2941-
"git ls-files --unmerged --stage" thing is sorta useful too,
2942-
actually. And note gitk --merge.
2943-
29443048
Add more good examples. Entire sections of just cookbook examples
29453049
might be a good idea; maybe make an "advanced examples" section a
29463050
standard end-of-chapter section?

0 commit comments

Comments
 (0)