From 2e294cf23b2114a107d22f7fdfaf06b61d0c7a17 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 9 Jan 2010 20:59:41 -0600 Subject: Documentation: git gc packs refs by default now In commit 56752391 (Make "git gc" pack all refs by default, 2007-05-24), 'git gc' was changed to run pack-refs by default Versions before v1.5.1.2 cannot clone repos with packed refs over http, and versions before v1.4.4 cannot handled packed refs at all, but more recent git should have no problems. Try to make this more clear in the git-config manual. The analagous passage in git-gc.txt was updated already with commit fe2128a (Change git-gc documentation to reflect gc.packrefs implementation., 2008-01-09). Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/config.txt | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'Documentation') diff --git a/Documentation/config.txt b/Documentation/config.txt index 7da332f0c..b6bd80e4a 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -875,15 +875,12 @@ gc.autopacklimit:: default value is 50. Setting this to 0 disables it. gc.packrefs:: - 'git gc' does not run `git pack-refs` in a bare repository by - default so that older dumb-transport clients can still fetch - from the repository. Setting this to `true` lets 'git gc' - to run `git pack-refs`. Setting this to `false` tells - 'git gc' never to run `git pack-refs`. The default setting is - `notbare`. Enable it only when you know you do not have to - support such clients. The default setting will change to `true` - at some stage, and setting this to `false` will continue to - prevent `git pack-refs` from being run from 'git gc'. + Running `git pack-refs` in a repository renders it + unclonable by Git versions prior to 1.5.1.2 over dumb + transports such as HTTP. This variable determines whether + 'git gc' runs `git pack-refs`. This can be set to "nobare" + to enable it within all non-bare repos or it can be set to a + boolean value. The default is `true`. gc.pruneexpire:: When 'git gc' is run, it will call 'prune --expire 2.weeks.ago'. -- cgit v1.2.1 From 63487e14c834f5e5093f8ef25fe983fffa1ff7a4 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 9 Jan 2010 21:01:21 -0600 Subject: Documentation: tiny git config manual tweaks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As a verb, 'setup' is spelled 'set up'. “diff commands such as diff-files” scans better without a comma. Clarify that shallow and deep are special non-boolean values for format.thread rather than boolean values with some other name. Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/config.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Documentation') diff --git a/Documentation/config.txt b/Documentation/config.txt index b6bd80e4a..8d3397c69 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -537,7 +537,7 @@ apply.whitespace:: as the '--whitespace' option. See linkgit:git-apply[1]. branch.autosetupmerge:: - Tells 'git branch' and 'git checkout' to setup new branches + Tells 'git branch' and 'git checkout' to set up new branches so that linkgit:git-pull[1] will appropriately merge from the starting point branch. Note that even if this option is not set, this behavior can be chosen per-branch using the `--track` @@ -725,7 +725,7 @@ diff.autorefreshindex:: contents in the work tree match the contents in the index. This option defaults to true. Note that this affects only 'git diff' Porcelain, and not lower level - 'diff' commands, such as 'git diff-files'. + 'diff' commands such as 'git diff-files'. diff.external:: If this config variable is set, diff generation is not @@ -841,8 +841,8 @@ format.pretty:: format.thread:: The default threading style for 'git format-patch'. Can be - either a boolean value, `shallow` or `deep`. `shallow` - threading makes every mail a reply to the head of the series, + a boolean value, or `shallow` or `deep`. `shallow` threading + makes every mail a reply to the head of the series, where the head is chosen from the cover letter, the `\--in-reply-to`, and the first patch mail, in this order. `deep` threading makes every mail a reply to the previous one. -- cgit v1.2.1 From 4fdff3d210724810a061f332bddd9607c856dd8a Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sun, 10 Jan 2010 13:05:04 +0100 Subject: Documentation: show-files is now called git-ls-files Amazingly, a reference to 'show files' survived from the core command documentation introduced in c64b9b8 (Reference documentation for the core git commands., 2005-05-05)! However, the tool is now called git-ls-files. Signed-off-by: Thomas Rast --- Documentation/git-ls-files.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/git-ls-files.txt b/Documentation/git-ls-files.txt index 7faba2386..a84cc3701 100644 --- a/Documentation/git-ls-files.txt +++ b/Documentation/git-ls-files.txt @@ -140,7 +140,7 @@ OPTIONS Output ------ -show files just outputs the filename unless '--stage' is specified in +'git ls-files' just outputs the filenames unless '--stage' is specified in which case it outputs: [ ] -- cgit v1.2.1 From 2d0f686c44bfb7055b317d178b703078b76dcc4f Mon Sep 17 00:00:00 2001 From: Thomas Rast Date: Sun, 10 Jan 2010 21:29:34 +0100 Subject: Documentation: emphasise 'git shortlog' in its synopsis The accepted style in the SYNOPSIS section is for a command to be 'emphasised'. Do so for the git-shortlog(1) manpage. Signed-off-by: Thomas Rast --- Documentation/git-shortlog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Documentation') diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt index ecf9e2718..dfd4d0c22 100644 --- a/Documentation/git-shortlog.txt +++ b/Documentation/git-shortlog.txt @@ -9,7 +9,7 @@ SYNOPSIS -------- [verse] git log --pretty=short | 'git shortlog' [-h] [-n] [-s] [-e] [-w] -git shortlog [-n|--numbered] [-s|--summary] [-e|--email] [-w[[,[,]]]] [...] +'git shortlog' [-n|--numbered] [-s|--summary] [-e|--email] [-w[[,[,]]]] [...] DESCRIPTION ----------- -- cgit v1.2.1 From 35e9d6303c15faf01fc9551d5ed648564dcd4014 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 23 Jan 2010 03:26:57 -0600 Subject: Documentation: merge: move configuration section to end Configuration and environment variables belong to the back matter of a manual page. Signed-off-by: Jonathan Nieder Acked-by: Petr Baudis Signed-off-by: Thomas Rast --- Documentation/git-merge.txt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index c88bebe36..6aa2bf370 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -48,15 +48,6 @@ include::merge-strategies.txt[] If you tried a merge which resulted in complex conflicts and want to start over, you can recover with 'git reset'. -CONFIGURATION -------------- -include::merge-config.txt[] - -branch..mergeoptions:: - Sets default options for merging into branch . The syntax and - supported options are the same as those of 'git merge', but option - values containing whitespace characters are currently not supported. - HOW MERGE WORKS --------------- @@ -249,6 +240,15 @@ changes into a merge commit. Small fixups like bumping release/version name would be acceptable. +CONFIGURATION +------------- +include::merge-config.txt[] + +branch..mergeoptions:: + Sets default options for merging into branch . The syntax and + supported options are the same as those of 'git merge', but option + values containing whitespace characters are currently not supported. + SEE ALSO -------- linkgit:git-fmt-merge-msg[1], linkgit:git-pull[1], -- cgit v1.2.1 From ed4a6baad0c8d446758eed8827e0d9190e624172 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 23 Jan 2010 03:31:19 -0600 Subject: Documentation: suggest `reset --merge` in How Merge Works section The 'merge' manual suggests 'reset' to cancel a merge at the end of the Merge Strategies list. It is more logical to explain this right before explaining how merge conflicts work, so the daunted reader can have a way out when he or she needs it most. While at it, make the advice more dependable and self-contained by providing the --merge option. Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/git-merge.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 6aa2bf370..1fecedbbc 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -45,9 +45,6 @@ include::merge-options.txt[] include::merge-strategies.txt[] -If you tried a merge which resulted in complex conflicts and -want to start over, you can recover with 'git reset'. - HOW MERGE WORKS --------------- @@ -115,6 +112,9 @@ When there are conflicts, the following happens: same and the index entries for them stay as they were, i.e. matching `HEAD`. +If you tried a merge which resulted in complex conflicts and +want to start over, you can recover with `git reset --merge`. + HOW CONFLICTS ARE PRESENTED --------------------------- -- cgit v1.2.1 From a4081bacfc78c1e1843590ed8d87544f3873dd10 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 23 Jan 2010 03:33:37 -0600 Subject: Documentation: merge: move merge strategy list to end So the section layout changes as follows: NAME SYNOPSIS DESCRIPTION OPTIONS -MERGE STRATEGIES HOW MERGE WORKS HOW CONFLICTS ARE PRESENTED HOW TO RESOLVE CONFLICTS EXAMPLES +MERGE STRATEGIES CONFIGURATION SEE ALSO AUTHOR DOCUMENTATION GIT NOTES The first-time user will care more about conflicts than about strategies other than 'recursive'. One of the examples uses -s ours, but I do not think this hinders readability. Suggested-by: Thomas Rast Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/git-merge.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 1fecedbbc..83bf3e783 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -42,8 +42,6 @@ include::merge-options.txt[] You need at least one . Specifying more than one obviously means you are trying an Octopus. -include::merge-strategies.txt[] - HOW MERGE WORKS --------------- @@ -240,6 +238,8 @@ changes into a merge commit. Small fixups like bumping release/version name would be acceptable. +include::merge-strategies.txt[] + CONFIGURATION ------------- include::merge-config.txt[] -- cgit v1.2.1 From b40bb374a618534b930ce4da5ffffb215b5cb488 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 23 Jan 2010 03:42:46 -0600 Subject: Documentation: merge: add an overview The reader unfamiliar with the concepts of branching and merging would have been completely lost. Try to help him with a diagram. Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/git-merge.txt | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 83bf3e783..e3c611dd0 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -15,8 +15,32 @@ SYNOPSIS DESCRIPTION ----------- -Merges the history specified by into HEAD, optionally using a -specific merge strategy. +Incorporates changes from the named commits (since the time their +histories diverged from the current branch) into the current +branch. This command is used by 'git pull' to incorporate changes +from another repository and can be used by hand to merge changes +from one branch into another. + +Assume the following history exists and the current branch is +"`master`": + +------------ + A---B---C topic + / + D---E---F---G master +------------ + +Then "`git merge topic`" will replay the changes made on the +`topic` branch since it diverged from `master` (i.e., `E`) until +its current commit (`C`) on top of `master`, and record the result +in a new commit along with the names of the two parent commits and +a log message from the user describing the changes. + +------------ + A---B---C topic + / \ + D---E---F---G---H master +------------ The second syntax ( `HEAD` ...) is supported for historical reasons. Do not use it from the command line or in -- cgit v1.2.1 From 30f2bade84a3f6961b38579c1c23c64b72f64f24 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 23 Jan 2010 03:44:17 -0600 Subject: Documentation: emphasize when git merge terminates early A merge-based operation in git can fail in two ways: one that stops before touching anything, or one that goes ahead and results in conflicts. As the 'git merge' manual explains: | A merge is always between the current `HEAD` and one or more | commits (usually, branch head or tag), and the index file must | match the tree of `HEAD` commit (i.e. the contents of the last commit) | when it starts out. Unfortunately, the placement of this sentence makes it easy to skip over, and its formulation leaves the important point, that any other attempted merge will be gracefully aborted, unspoken. So give this point its own section and expand upon it. Probably this could be simplified somewhat: after all, a change registered in the index is just a special kind of local uncommited change, so the second added paragraph is only a special case of the first. It seemed more helpful to be explicit here. Inspired by . Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/git-merge.txt | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index e3c611dd0..6acee231b 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -67,21 +67,32 @@ include::merge-options.txt[] obviously means you are trying an Octopus. +PRE-MERGE CHECKS +---------------- + +Before applying outside changes, you should get your own work in +good shape and committed locally, so it will not be clobbered if +there are conflicts. See also linkgit:git-stash[1]. +'git pull' and 'git merge' will stop without doing anything when +local uncommitted changes overlap with files that 'git pull'/'git +merge' may need to update. + +To avoid recording unrelated changes in the merge commit, +'git pull' and 'git merge' will also abort if there are any changes +registered in the index relative to the `HEAD` commit. (One +exception is when the changed index entries are in the state that +would result from the merge already.) + +If all named commits are already ancestors of `HEAD`, 'git merge' +will exit early with the message "Already up-to-date." + HOW MERGE WORKS --------------- A merge is always between the current `HEAD` and one or more -commits (usually, branch head or tag), and the index file must -match the tree of `HEAD` commit (i.e. the contents of the last commit) -when it starts out. In other words, `git diff --cached HEAD` must -report no changes. (One exception is when the changed index -entries are already in the same state that would result from -the merge anyway.) - -Three kinds of merge can happen: +commits (usually a branch head or tag). -* The merged commit is already contained in `HEAD`. This is the - simplest case, called "Already up-to-date." +Two kinds of merge can happen: * `HEAD` is already contained in the merged commit. This is the most common case especially when invoked from 'git pull': -- cgit v1.2.1 From 29280311f0282857360add2b49db5fc7148d4813 Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 23 Jan 2010 03:45:33 -0600 Subject: Documentation: merge: add a section about fast-forward Novices sometimes find the behavior of 'git merge' in the fast-forward case surprising. Describe it thoroughly. Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/git-merge.txt | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 6acee231b..6bebada97 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -86,25 +86,30 @@ would result from the merge already.) If all named commits are already ancestors of `HEAD`, 'git merge' will exit early with the message "Already up-to-date." +FAST-FORWARD MERGE +------------------ + +Often the current branch head is an ancestor of the named commit. +This is the most common case especially when invoked from 'git +pull': you are tracking an upstream repository, you have committed +no local changes, and now you want to update to a newer upstream +revision. In this case, a new commit is not needed to store the +combined history; instead, the `HEAD` (along with the index) is +updated to point at the named commit, without creating an extra +merge commit. + +This behavior can be suppressed with the `--no-ff` option. + HOW MERGE WORKS --------------- A merge is always between the current `HEAD` and one or more commits (usually a branch head or tag). -Two kinds of merge can happen: - -* `HEAD` is already contained in the merged commit. This is the - most common case especially when invoked from 'git pull': - you are tracking an upstream repository, have committed no local - changes and now you want to update to a newer upstream revision. - Your `HEAD` (and the index) is updated to point at the merged - commit, without creating an extra merge commit. This is - called "Fast-forward". - -* Both the merged commit and `HEAD` are independent and must be - tied together by a merge commit that has both of them as its parents. - The rest of this section describes this "True merge" case. +Except in a fast-forward merge (see above), the branches to be +merged must be tied together by a merge commit that has both of them +as its parents. +The rest of this section describes this "True merge" case. The chosen merge strategy merges the two commits into a single new source tree. -- cgit v1.2.1 From ebef7e504913a1480310735af9541e26c0b381ba Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 23 Jan 2010 03:48:42 -0600 Subject: Documentation: simplify How Merge Works The user most likely does not care about the exact order of operations because he cannot see it happening anyway. Instead, try to explain what it means to merge two commits into a single tree. While at it: - Change the heading to TRUE MERGE. The entire manual page is about how merges work. - Document MERGE_HEAD. It is a useful feature, since it makes the parents of the intended merge commit easier to refer to. - Do not assume commits named on the 'git merge' command line come from another repository. For simplicity, the discussion of conflicts still does assume that there is only one and it is a branch head. - Do not start list items with `code`. Otherwise, a toolchain bug produces a line break in the generated nroff, resulting in odd extra space. Suggested-by: Thomas Rast Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/git-merge.txt | 52 ++++++++++++++------------------------------- 1 file changed, 16 insertions(+), 36 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 6bebada97..6412805f0 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -100,52 +100,32 @@ merge commit. This behavior can be suppressed with the `--no-ff` option. -HOW MERGE WORKS ---------------- - -A merge is always between the current `HEAD` and one or more -commits (usually a branch head or tag). +TRUE MERGE +---------- Except in a fast-forward merge (see above), the branches to be merged must be tied together by a merge commit that has both of them as its parents. -The rest of this section describes this "True merge" case. - -The chosen merge strategy merges the two commits into a single -new source tree. -When things merge cleanly, this is what happens: - -1. The results are updated both in the index file and in your - working tree; -2. Index file is written out as a tree; -3. The tree gets committed; and -4. The `HEAD` pointer gets advanced. -Because of 2., we require that the original state of the index -file matches exactly the current `HEAD` commit; otherwise we -will write out your local changes already registered in your -index file along with the merge result, which is not good. -Because 1. involves only those paths differing between your -branch and the branch you are merging -(which is typically a fraction of the whole tree), you can -have local modifications in your working tree as long as they do -not overlap with what the merge updates. +A merged version reconciling the changes from all branches to be +merged is committed, and your `HEAD`, index, and working tree are +updated to it. It is possible to have modifications in the working +tree as long as they do not overlap; the update will preserve them. -When there are conflicts, the following happens: +When it is not obvious how to reconcile the changes, the following +happens: -1. `HEAD` stays the same. - -2. Cleanly merged paths are updated both in the index file and +1. The `HEAD` pointer stays the same. +2. The `MERGE_HEAD` ref is set to point to the other branch head. +3. Paths that merged cleanly are updated both in the index file and in your working tree. - -3. For conflicting paths, the index file records up to three - versions; stage1 stores the version from the common ancestor, - stage2 from `HEAD`, and stage3 from the other branch (you +4. For conflicting paths, the index file records up to three + versions: stage 1 stores the version from the common ancestor, + stage 2 from `HEAD`, and stage 3 from `MERGE_HEAD` (you can inspect the stages with `git ls-files -u`). The working tree files contain the result of the "merge" program; i.e. 3-way - merge results with familiar conflict markers `<<< === >>>`. - -4. No other changes are done. In particular, the local + merge results with familiar conflict markers `<<<` `===` `>>>`. +5. No other changes are made. In particular, the local modifications you had before you started merge will stay the same and the index entries for them stay as they were, i.e. matching `HEAD`. -- cgit v1.2.1 From 3588cf94812d47dd34b82039c7776f5225a947fb Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Sat, 23 Jan 2010 16:48:40 -0600 Subject: Documentation: merge: use MERGE_HEAD to refer to the remote branch commit 57bddb11 (Documentation/git-merge: reword references to "remote" and "pull", 2010-01-07) fixed the manual to drop the assumption that the other branch being merged is from a remote repository. Unfortunately, in a few places, to do so it introduced the antecedentless phrase "their versions". Worse, in passages like the following, 'they' is playing two roles. | highlighting changes from both the HEAD and their versions. | | * Look at the diffs on their own. 'git log --merge -p ' Using HEAD and MERGE_HEAD nicely assigns terminology to "our" and "their" sides. It also provides the reader with practice using names that git will recognize on the command line. Signed-off-by: Jonathan Nieder Signed-off-by: Thomas Rast --- Documentation/git-merge.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'Documentation') diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt index 6412805f0..e9e2b0cd9 100644 --- a/Documentation/git-merge.txt +++ b/Documentation/git-merge.txt @@ -215,15 +215,17 @@ You can work through the conflict with a number of tools: mergetool which will work you through the merge. * Look at the diffs. `git diff` will show a three-way diff, - highlighting changes from both the HEAD and their versions. + highlighting changes from both the `HEAD` and `MERGE_HEAD` + versions. - * Look at the diffs on their own. `git log --merge -p ` - will show diffs first for the HEAD version and then - their version. + * Look at the diffs from each branch. `git log --merge -p ` + will show diffs first for the `HEAD` version and then the + `MERGE_HEAD` version. * Look at the originals. `git show :1:filename` shows the - common ancestor, `git show :2:filename` shows the HEAD - version and `git show :3:filename` shows their version. + common ancestor, `git show :2:filename` shows the `HEAD` + version, and `git show :3:filename` shows the `MERGE_HEAD` + version. EXAMPLES -- cgit v1.2.1