git-commit-vandalism/Documentation
Jeff King a9f5a3558d remote: separate the concept of push and fetch mirrors
git-remote currently has one option, "--mirror", which sets
up mirror configuration which can be used for either
fetching or pushing. It looks like this:

  [remote "mirror"]
    url = wherever
    fetch = +refs/*:refs/*
    mirror = true

However, a remote like this can be dangerous and confusing.
Specifically:

  1. If you issue the wrong command, it can be devastating.
     You are not likely to "push" when you meant to "fetch",
     but "git remote update" will try to fetch it, even if
     you intended the remote only for pushing. In either
     case, the results can be quite destructive. An
     unintended push will overwrite or delete remote refs,
     and an unintended fetch can overwrite local branches.

  2. The tracking setup code can produce confusing results.
     The fetch refspec above means that "git checkout -b new
     master" will consider refs/heads/master to come from
     the remote "mirror", even if you only ever intend to
     push to the mirror. It will set up the "new" branch to
     track mirror's refs/heads/master.

  3. The push code tries to opportunistically update
     tracking branches. If you "git push mirror foo:bar",
     it will see that we are updating mirror's
     refs/heads/bar, which corresponds to our local
     refs/heads/bar, and will update our local branch.

To solve this, we split the concept into "push mirrors" and
"fetch mirrors". Push mirrors set only remote.*.mirror,
solving (2) and (3), and making an accidental fetch write
only into FETCH_HEAD. Fetch mirrors set only the fetch
refspec, meaning an accidental push will not force-overwrite
or delete refs on the remote end.

The new syntax is "--mirror=<fetch|push>". For
compatibility, we keep "--mirror" as-is, setting up both
types simultaneously.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-03-30 13:47:53 -07:00
..
howto Documentation/merge subtree How-To: fix typo 2011-02-09 14:03:51 -08:00
pt_BR Documentation: update pt-BR 2009-10-01 08:21:35 -04:00
RelNotes Git 1.7.4.2 2011-03-25 17:56:14 -07:00
technical Fix typos in the documentation 2011-01-04 11:23:42 -08:00
.gitattributes Define the project whitespace policy 2008-02-11 13:23:15 -08:00
.gitignore Documentation: Avoid use of xmlto --stringparam 2009-12-05 10:03:49 -08:00
asciidoc.conf Merge branch 'jc/maint-doc-em-dash' 2010-09-03 09:43:42 -07:00
blame-options.txt blame-options.txt: Add default value for -M/-C options. 2010-05-07 09:34:59 -07:00
build-docdep.perl
cat-texi.perl Fix the building of gitman.info document 2008-12-29 00:40:10 -08:00
cmd-list.perl Documentation: rename gitlink macro to linkgit 2008-01-06 18:41:44 -08:00
CodingGuidelines CodingGuidelines: downcase placeholders in usage messages 2011-02-15 11:53:00 -08:00
config.txt Merge branch 'jh/push-default-upstream-configname' into maint 2011-03-16 16:47:26 -07:00
date-formats.txt Document date formats accepted by parse_date() 2009-12-03 12:41:37 -08:00
diff-format.txt Fix typos in technical documentation. 2010-01-31 10:24:53 -08:00
diff-generate-patch.txt diff format documentation: clarify --cc and -c 2011-03-08 14:44:07 -08:00
diff-options.txt diff: use "find" instead of "detect" as prefix for long forms of -M and -C 2010-12-10 13:52:05 -08:00
docbook-xsl.css docbook: change css style 2009-04-06 00:27:09 -07:00
docbook.xsl Documentation: set a !DOCTYPE for user manual 2010-08-20 10:53:56 -07:00
everyday.txt everyday.txt: change "tracking branch" to "remote-tracking branch" 2010-11-03 09:19:10 -07:00
fetch-options.txt pull: Document the "--[no-]recurse-submodules" options 2011-02-07 15:19:09 -08:00
fix-texi.perl Add support for an info version of the user manual 2007-08-10 23:16:18 -07:00
git-add.txt Fix typos in the documentation 2011-01-04 11:23:42 -08:00
git-am.txt git-am.txt: advertise 'git am --abort' instead of 'rm .git/rebase-apply' 2011-03-22 14:31:21 -07:00
git-annotate.txt Documentation: minor grammatical fixes. 2009-03-02 12:34:54 -08:00
git-apply.txt Documentation: fix a typo in git-apply.txt 2011-03-04 10:05:00 -08:00
git-archimport.txt Martin Langhoff has a new e-mail address 2010-10-06 12:08:48 -07:00
git-archive.txt Merge branch 'maint-1.7.2' into maint 2011-01-10 10:39:28 -08:00
git-bisect-lk2009.txt Documentation: remove stray backslashes from "Fighting regressions" article 2010-08-20 14:16:51 -07:00
git-bisect.txt bisect: explain the rationale behind 125 2011-03-19 21:46:24 -07:00
git-blame.txt blame: Add option to show author email instead of name 2010-10-19 12:00:28 -07:00
git-branch.txt git-branch.txt: mention --set-upstream as a way to change upstream configuration 2010-11-03 09:20:48 -07:00
git-bundle.txt Fix typos in the documentation 2011-01-04 11:23:42 -08:00
git-cat-file.txt Documentation: gitrevisions is in section 7 2010-10-13 19:10:55 -07:00
git-check-attr.txt Documentation: minor grammatical fixes in git-check-attr.txt 2009-03-22 21:02:38 -07:00
git-check-ref-format.txt Documentation: gitrevisions is in section 7 2010-10-13 19:10:55 -07:00
git-checkout-index.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-checkout.txt Change incorrect uses of "remote branch" meaning "remote-tracking" 2010-11-03 09:20:47 -07:00
git-cherry-pick.txt Documentation: Fix mark-up of lines with more than one tilde 2010-12-02 11:30:35 -08:00
git-cherry.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-citool.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-clean.txt Add -e/--exclude to git-clean. 2010-07-20 16:52:53 -07:00
git-clone.txt Merge branch 'jl/clone-recurse-sm-synonym' 2010-11-29 17:52:34 -08:00
git-commit-tree.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-commit.txt Documentation: clarify -u<mode> option defaults 2011-02-21 21:48:55 -08:00
git-config.txt Merge remote branch 'remotes/trast-doc/for-next' 2010-01-20 20:28:49 -08:00
git-count-objects.txt count-objects: Add total pack size to verbose output 2008-08-17 01:01:42 -07:00
git-cvsexportcommit.txt Martin Langhoff has a new e-mail address 2010-10-06 12:08:48 -07:00
git-cvsimport.txt Documentation: spelling fixes 2010-07-20 16:59:17 -07:00
git-cvsserver.txt Martin Langhoff has a new e-mail address 2010-10-06 12:08:48 -07:00
git-daemon.txt daemon: make --inetd and --detach incompatible 2010-11-04 16:53:52 -07:00
git-describe.txt Change incorrect uses of "remote branch" meaning "remote-tracking" 2010-11-03 09:20:47 -07:00
git-diff-files.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-diff-index.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-diff-tree.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-diff.txt diff: support --cached on unborn branches 2011-02-07 15:04:30 -08:00
git-difftool.txt Merge branch 'maint' 2010-12-16 16:36:03 -08:00
git-fast-export.txt Use angles for placeholders consistently 2010-10-08 12:29:52 -07:00
git-fast-import.txt Merge branch 'maint-1.7.0' into maint 2011-02-09 16:40:12 -08:00
git-fetch-pack.txt Documentation: describe --thin more accurately 2010-02-18 17:13:18 -08:00
git-fetch.txt Change "tracking branch" to "remote-tracking branch" 2010-11-03 09:20:41 -07:00
git-filter-branch.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-fmt-merge-msg.txt Fix typos in the documentation 2011-01-04 11:23:42 -08:00
git-for-each-ref.txt Add Author and Documentation sections to git-for-each-ref.txt 2011-03-09 12:22:15 -08:00
git-format-patch.txt Merge branch 'maint' 2010-10-13 20:20:09 -07:00
git-fsck-objects.txt Documentation: be consistent about "git-" versus "git " 2008-07-01 17:20:15 -07:00
git-fsck.txt fsck docs: remove outdated and useless diagnostic 2010-12-18 22:58:40 -08:00
git-gc.txt Merge branch 'maint' 2010-12-19 17:49:42 -08:00
git-get-tar-commit-id.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-grep.txt grep: Add the option '--line-number' 2011-03-28 14:02:12 -07:00
git-gui.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-hash-object.txt Documentation: spelling fixes 2010-07-20 16:59:17 -07:00
git-help.txt Work around em-dash handling in newer AsciiDoc 2010-08-24 09:48:20 -07:00
git-http-backend.txt Documentation: Clarify support for smart HTTP backend 2010-03-30 16:49:19 -07:00
git-http-fetch.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-http-push.txt Use 'fast-forward' all over the place 2009-10-24 23:50:28 -07:00
git-imap-send.txt Merge branch 'rr/imap-send-unconfuse-from-line' 2010-04-03 12:28:42 -07:00
git-index-pack.txt Use angles for placeholders consistently 2010-10-08 12:29:52 -07:00
git-init-db.txt init-db: migrate to parse-options 2009-07-12 14:36:40 -07:00
git-init.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-instaweb.txt Merge branch 'jc/maint-doc-em-dash' 2010-09-03 09:43:42 -07:00
git-log.txt Replace "remote tracking" with "remote-tracking" 2010-11-03 09:19:04 -07:00
git-lost-found.txt Documentation: be consistent about "git-" versus "git " 2008-07-01 17:20:15 -07:00
git-ls-files.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-ls-remote.txt ls-remote documentation: <refs> argument is optional 2011-03-09 12:32:00 -08:00
git-ls-tree.txt Use angles for placeholders consistently 2010-10-08 12:29:52 -07:00
git-mailinfo.txt git-mailinfo documentation: clarify -u/--encoding 2010-06-13 20:18:23 -07:00
git-mailsplit.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-merge-base.txt merge-base --independent to print reduced parent list in a merge 2010-08-18 14:02:03 -07:00
git-merge-file.txt merge-file: add option to select union merge favor 2010-03-02 21:16:45 -08:00
git-merge-index.txt Documentation: remove backslashes in manpage synopses 2010-08-20 14:16:22 -07:00
git-merge-one-file.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-merge-tree.txt Improve language in git-merge.txt and related docs 2008-12-09 20:57:52 -08:00
git-merge.txt Merge branch 'jh/notes-merge' 2010-12-08 11:24:12 -08:00
git-mergetool--lib.txt Work around em-dash handling in newer AsciiDoc 2010-08-24 09:48:20 -07:00
git-mergetool.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-mktag.txt Documentation: be consistent about "git-" versus "git " 2008-07-01 17:20:15 -07:00
git-mktree.txt mktree --batch: build more than one tree object 2009-05-16 10:28:59 -07:00
git-mv.txt UI consistency: allow --force for where -f means force 2009-08-29 14:08:03 -07:00
git-name-rev.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-notes.txt Provide 'git notes get-ref' to easily retrieve current notes ref 2010-11-17 13:23:55 -08:00
git-pack-objects.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-pack-redundant.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-pack-refs.txt doc/git-pack-refs: fix two grammar issues 2009-04-05 00:39:37 -07:00
git-parse-remote.txt parse-remote: remove unused functions 2009-06-11 19:50:45 -07:00
git-patch-id.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-peek-remote.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-prune-packed.txt prune-packed: migrate to parse-options 2009-07-10 23:57:21 -07:00
git-prune.txt prune: allow --dry-run for -n and --verbose for -v 2010-08-09 10:13:18 -07:00
git-pull.txt pull: Document the "--[no-]recurse-submodules" options 2011-02-07 15:19:09 -08:00
git-push.txt Documentation: gitrevisions is in section 7 2010-10-13 19:10:55 -07:00
git-quiltimport.txt quiltimport documentation: --dry-run and -n are synonyms 2009-09-13 01:32:49 -07:00
git-read-tree.txt Merge branch 'nd/maint-fix-add-typo-detection' 2010-12-22 14:40:26 -08:00
git-rebase.txt rebase: support --verify 2010-11-23 12:15:43 -08:00
git-receive-pack.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-reflog.txt Documentation: gitrevisions is in section 7 2010-10-13 19:10:55 -07:00
git-relink.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-remote-ext.txt Make <identifier> lowercase in Documentation 2011-02-17 11:49:54 -08:00
git-remote-fd.txt Fix typos in the documentation 2011-01-04 11:23:42 -08:00
git-remote-helpers.txt Make <identifier> lowercase in Documentation 2011-02-17 11:49:54 -08:00
git-remote.txt remote: separate the concept of push and fetch mirrors 2011-03-30 13:47:53 -07:00
git-repack.txt Merge branch 'jk/repack-reuse-object' into maint 2010-11-24 12:45:07 -08:00
git-replace.txt Documentation: format full commands in typewriter font 2010-01-10 13:01:25 +01:00
git-repo-config.txt Documentation: be consistent about "git-" versus "git " 2008-07-01 17:20:15 -07:00
git-request-pull.txt request-pull.txt: Document -p option 2010-07-25 21:52:19 -07:00
git-rerere.txt rerere.txt: Document forget subcommand 2010-07-05 11:51:20 -07:00
git-reset.txt Documentation: do not treat reset --keep as a special case 2011-01-21 12:41:14 -08:00
git-rev-list.txt Use parentheses and `...' where appropriate 2010-10-08 12:31:07 -07:00
git-rev-parse.txt git-rev-parse.txt: clarify --git-dir 2010-11-29 13:26:00 -08:00
git-revert.txt Documentation: Fix mark-up of lines with more than one tilde 2010-12-02 11:30:35 -08:00
git-rm.txt git-rm.txt: Fix quoting 2010-12-07 13:13:21 -08:00
git-send-email.txt Merge branch 'maint' 2010-12-10 16:36:53 -08:00
git-send-pack.txt Documentation: describe --thin more accurately 2010-02-18 17:13:18 -08:00
git-sh-setup.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-shell.txt shell: Rewrite documentation and improve error message 2010-08-24 10:47:21 -07:00
git-shortlog.txt Remove stray quotes in --pretty and --format documentation 2010-10-08 12:31:07 -07:00
git-show-branch.txt Merge branch 'sn/doc-opt-notation' into maint 2010-10-21 16:26:42 -07:00
git-show-index.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-show-ref.txt git-show-ref.txt: clarify the pattern matching 2010-10-19 14:15:30 -07:00
git-show.txt Documentation: document show -s 2010-11-09 09:42:57 -08:00
git-stage.txt Add a built-in alias for 'stage' to the 'add' command 2008-12-02 16:13:16 -08:00
git-stash.txt detached-stash: update Documentation 2010-08-21 23:51:22 -07:00
git-status.txt Documentation: clarify -u<mode> option defaults 2011-02-21 21:48:55 -08:00
git-stripspace.txt Documentation: be consistent about "git-" versus "git " 2008-07-01 17:20:15 -07:00
git-submodule.txt git submodule add: Remove old docs about implicit -f 2010-07-19 11:11:07 -07:00
git-svn.txt Make <identifier> lowercase in Documentation 2011-02-17 11:49:54 -08:00
git-symbolic-ref.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-tag.txt git tag documentation grammar fixes and readability updates 2011-03-28 14:14:45 -07:00
git-tar-tree.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-tools.txt Remove outdated references to cogito in documentation 2007-10-29 12:53:50 -07:00
git-unpack-file.txt Documentation: be consistent about "git-" versus "git " 2008-07-01 17:20:15 -07:00
git-unpack-objects.txt Documentation formatting and cleanup 2008-07-01 17:20:16 -07:00
git-update-index.txt Merge branch 'sn/doc-opt-notation' into maint 2010-10-21 16:26:42 -07:00
git-update-ref.txt Documentation: be consistent about "git-" versus "git " 2008-07-01 17:20:15 -07:00
git-update-server-info.txt Remove obsolete bug warning in man git-update-server-info 2009-04-25 09:29:38 -07:00
git-upload-archive.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-upload-pack.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-var.txt Fix 'git var' usage synopsis 2010-02-14 18:23:16 -08:00
git-verify-pack.txt verify-pack: add --stat-only to the synopsis section 2011-03-01 11:26:22 -08:00
git-verify-tag.txt verify-tag: document --verbose 2010-11-15 10:05:54 -08:00
git-web--browse.txt web--browse: better support for chromium 2010-12-03 14:05:32 -08:00
git-whatchanged.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git-write-tree.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
git.txt Git 1.7.4.1 2011-02-11 14:39:55 -08:00
gitattributes.txt docs: fix grammar in gitattributes.txt 2011-03-18 09:58:47 -07:00
gitcli.txt Update "describe" documentation to match reality 2009-09-22 19:40:05 -07:00
gitcore-tutorial.txt Documentation: gitrevisions is in section 7 2010-10-13 19:10:55 -07:00
gitcvs-migration.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
gitdiffcore.txt gitdiffcore doc: update pickaxe description 2010-08-31 14:28:20 -07:00
gitglossary.txt Documentation: fix links to "everyday.html" 2008-11-14 21:48:10 -08:00
githooks.txt Documentation/githooks: post-rewrite-copy-notes never existed 2011-01-10 09:09:02 -08:00
gitignore.txt Documentation: point to related commands from gitignore 2010-11-11 10:57:16 -08:00
gitk.txt Documentation: gitrevisions is in section 7 2010-10-13 19:10:55 -07:00
gitmodules.txt Fix typos in the documentation 2011-01-04 11:23:42 -08:00
gitrepository-layout.txt Documentation: spelling fixes 2010-07-20 16:59:17 -07:00
gitrevisions.txt Documentation: gitrevisions 2010-07-05 13:39:02 -07:00
gittutorial-2.txt Better "Changed but not updated" message in git-status 2010-11-03 09:18:58 -07:00
gittutorial.txt Change remote tracking to remote-tracking in non-trivial places 2010-11-03 09:19:08 -07:00
gitworkflows.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
glossary-content.txt Change "tracking branch" to "remote-tracking branch" 2010-11-03 09:20:41 -07:00
howto-index.sh
i18n.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
install-doc-quick.sh install-doc-quick - use git --exec-path to find git-sh-setup 2008-07-08 16:36:03 -07:00
install-webdoc.sh install-webdoc: keep installed RelNotes-*.txt 2010-09-09 16:17:59 -07:00
mailmap.txt Documentation: minor grammatical fixes in git-blame.txt. 2009-03-17 12:08:43 -07:00
Makefile docs: default to more modern toolset 2010-11-24 15:13:58 -08:00
manpage-1.72.xsl Documentation: move quieting params into manpage-base.xsl 2009-03-27 00:33:19 -07:00
manpage-base-url.xsl.in Documentation: Avoid use of xmlto --stringparam 2009-12-05 10:03:49 -08:00
manpage-base.xsl Documentation: use "spurious .sp" XSLT if DOCBOOK_SUPPRESS_SP is set 2009-04-01 11:02:42 -07:00
manpage-bold-literal.xsl Documentation: option to render literal text as bold for manpages 2009-03-27 00:33:20 -07:00
manpage-normal.xsl Documentation: move "spurious .sp" code into manpage-base.xsl 2009-03-27 00:33:19 -07:00
manpage-quote-apos.xsl Quote ' as \(aq in manpages 2009-10-22 12:59:50 -07:00
manpage-suppress-sp.xsl Documentation: use "spurious .sp" XSLT if DOCBOOK_SUPPRESS_SP is set 2009-04-01 11:02:42 -07:00
merge-config.txt Fix typos in the documentation 2011-01-04 11:23:42 -08:00
merge-options.txt merge: Make '--log' an integer option for number of shortlog entries 2010-09-09 11:39:20 -07:00
merge-strategies.txt Merge branch 'kb/merge-recursive-rename-threshold' 2010-10-26 21:54:04 -07:00
pretty-formats.txt pretty: Introduce ' ' modifier to add space if non-empty 2010-06-16 14:45:09 -07:00
pretty-options.txt Remove stray quotes in --pretty and --format documentation 2010-10-08 12:31:07 -07:00
pull-fetch-param.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
rev-list-options.txt rev-list-options.txt: typo fix 2011-03-08 11:56:37 -08:00
revisions.txt Merge branch 'nd/oneline-sha1-name-from-specific-ref' 2010-12-21 14:30:19 -08:00
SubmittingPatches SubmittingPatches: clarify the expected commit log description 2011-03-08 21:35:22 -08:00
urls-remotes.txt Documentation: spell 'git cmd' without dash throughout 2010-01-10 13:01:28 +01:00
urls.txt Documentation: spelling fixes 2010-07-20 16:59:17 -07:00
user-manual.conf Documentation: rename gitlink macro to linkgit 2008-01-06 18:41:44 -08:00
user-manual.txt user-manual: remote-tracking can be checked out, with detached HEAD 2010-11-03 09:20:48 -07:00