summaryrefslogtreecommitdiffstats
path: root/git-fetch.html
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-09-17 15:45:52 -0700
committerJunio C Hamano <gitster@pobox.com>2018-09-17 15:45:52 -0700
commit980e61ec567f55c9247391052477e61a32d24548 (patch)
tree6fe236d0a6fd3ffa6a1be9a52219ed50b7dfcd19 /git-fetch.html
parenta68ff6db4d42f41cb49143a5423fbe50f539043e (diff)
downloadgit-htmldocs-980e61ec567f55c9247391052477e61a32d24548.tar.gz
Autogenerated HTML docs for v2.19.0-216-g2d3b1c
Diffstat (limited to 'git-fetch.html')
-rw-r--r--git-fetch.html43
1 files changed, 33 insertions, 10 deletions
diff --git a/git-fetch.html b/git-fetch.html
index 592bb4440..906a062ff 100644
--- a/git-fetch.html
+++ b/git-fetch.html
@@ -908,11 +908,10 @@ documented in <a href="git-config.html">git-config(1)</a>.</p></div>
</dt>
<dd>
<p>
- When <em>git fetch</em> is used with <code>&lt;rbranch&gt;:&lt;lbranch&gt;</code>
- refspec, it refuses to update the local branch
- <code>&lt;lbranch&gt;</code> unless the remote branch <code>&lt;rbranch&gt;</code> it
- fetches is a descendant of <code>&lt;lbranch&gt;</code>. This option
- overrides that check.
+ When <em>git fetch</em> is used with <code>&lt;src&gt;:&lt;dst&gt;</code> refspec it may
+ refuse to update the local branch as discussed
+ in the <code>&lt;refspec&gt;</code> part below.
+ This option overrides that check.
</p>
</dd>
<dt class="hdlist1">
@@ -1217,11 +1216,35 @@ name.</p></div>
<div class="paragraph"><p><code>tag &lt;tag&gt;</code> means the same as <code>refs/tags/&lt;tag&gt;:refs/tags/&lt;tag&gt;</code>;
it requests fetching everything up to the given tag.</p></div>
<div class="paragraph"><p>The remote ref that matches &lt;src&gt;
-is fetched, and if &lt;dst&gt; is not an empty string, the local
-ref that matches it is fast-forwarded using &lt;src&gt;.
-If the optional plus <code>+</code> is used, the local ref
-is updated even if it does not result in a fast-forward
-update.</p></div>
+is fetched, and if &lt;dst&gt; is not an empty string, an attempt
+is made to update the local ref that matches it.</p></div>
+<div class="paragraph"><p>Whether that update is allowed without <code>--force</code> depends on the ref
+namespace it&#8217;s being fetched to, the type of object being fetched, and
+whether the update is considered to be a fast-forward. Generally, the
+same rules apply for fetching as when pushing, see the <code>&lt;refspec&gt;...</code>
+section of <a href="git-push.html">git-push(1)</a> for what those are. Exceptions to those
+rules particular to <em>git fetch</em> are noted below.</p></div>
+<div class="paragraph"><p>Until Git version 2.20, and unlike when pushing with
+<a href="git-push.html">git-push(1)</a>, any updates to <code>refs/tags/*</code> would be accepted
+without <code>+</code> in the refspec (or <code>--force</code>). The receiving promiscuously
+considered all tag updates from a remote to be forced fetches. Since
+Git version 2.20, fetching to update <code>refs/tags/*</code> work the same way
+as when pushing. I.e. any updates will be rejected without <code>+</code> in the
+refspec (or <code>--force</code>).</p></div>
+<div class="paragraph"><p>Unlike when pushing with <a href="git-push.html">git-push(1)</a>, any updates outside of
+<code>refs/{tags,heads}/*</code> will be accepted without <code>+</code> in the refspec (or
+<code>--force</code>), whether that&#8217;s swapping e.g. a tree object for a blob, or
+a commit for another commit that&#8217;s doesn&#8217;t have the previous commit as
+an ancestor etc.</p></div>
+<div class="paragraph"><p>Unlike when pushing with <a href="git-push.html">git-push(1)</a>, there is no
+configuration which&#8217;ll amend these rules, and nothing like a
+<code>pre-fetch</code> hook analogous to the <code>pre-receive</code> hook.</p></div>
+<div class="paragraph"><p>As with pushing with <a href="git-push.html">git-push(1)</a>, all of the rules described
+above about what&#8217;s not allowed as an update can be overridden by
+adding an the optional leading <code>+</code> to a refspec (or using <code>--force</code>
+command line option). The only exception to this is that no amount of
+forcing will make the <code>refs/heads/*</code> namespace accept a non-commit
+object.</p></div>
<div class="admonitionblock">
<table><tr>
<td class="icon">