path: root/Documentation/fetch-options.txt
diff options
authorJunio C Hamano <>2020-08-18 14:25:22 (GMT)
committerJunio C Hamano <>2020-08-18 19:56:57 (GMT)
commit887952b8c680626f4721cb5fa57704478801aca4 (patch)
treee7cb5dd64843558d9cd4eb2e374a28e1464fb2c7 /Documentation/fetch-options.txt
parent2befe97201e1f3175cce557866c5822793624b5a (diff)
fetch: optionally allow disabling FETCH_HEAD update
If you run fetch but record the result in remote-tracking branches, and either if you do nothing with the fetched refs (e.g. you are merely mirroring) or if you always work from the remote-tracking refs (e.g. you fetch and then merge origin/branchname separately), you can get away with having no FETCH_HEAD at all. Teach "git fetch" a command line option "--[no-]write-fetch-head". The default is to write FETCH_HEAD, and the option is primarily meant to be used with the "--no-" prefix to override this default, because there is no matching fetch.writeFetchHEAD configuration variable to flip the default to off (in which case, the positive form may become necessary to defeat it). Note that under "--dry-run" mode, FETCH_HEAD is never written; otherwise you'd see list of objects in the file that you do not actually have. Passing `--write-fetch-head` does not force `git fetch` to write the file. Signed-off-by: Derrick Stolee <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'Documentation/fetch-options.txt')
1 files changed, 9 insertions, 0 deletions
diff --git a/Documentation/fetch-options.txt b/Documentation/fetch-options.txt
index 6e2a160..07d06ff 100644
--- a/Documentation/fetch-options.txt
+++ b/Documentation/fetch-options.txt
@@ -64,6 +64,15 @@ documented in linkgit:git-config[1].
Show what would be done, without making any changes.
+ Write the list of remote refs fetched in the `FETCH_HEAD`
+ file directly under `$GIT_DIR`. This is the default.
+ Passing `--no-write-fetch-head` from the command line tells
+ Git not to write the file. Under `--dry-run` option, the
+ file is never written.
When 'git fetch' is used with `<src>:<dst>` refspec it may