Git fork
at reftables-rust 269 lines 8.8 kB view raw
1git-remote(1) 2============= 3 4NAME 5---- 6git-remote - Manage set of tracked repositories 7 8 9SYNOPSIS 10-------- 11[verse] 12'git remote' [-v | --verbose] 13'git remote add' [-t <branch>] [-m <master>] [-f] [--[no-]tags] [--mirror=(fetch|push)] <name> <URL> 14'git remote rename' [--[no-]progress] <old> <new> 15'git remote remove' <name> 16'git remote set-head' <name> (-a | --auto | -d | --delete | <branch>) 17'git remote set-branches' [--add] <name> <branch>... 18'git remote get-url' [--push] [--all] <name> 19'git remote set-url' [--push] <name> <newurl> [<oldurl>] 20'git remote set-url --add' [--push] <name> <newurl> 21'git remote set-url --delete' [--push] <name> <URL> 22'git remote' [-v | --verbose] 'show' [-n] <name>... 23'git remote prune' [-n | --dry-run] <name>... 24'git remote' [-v | --verbose] 'update' [-p | --prune] [(<group> | <remote>)...] 25 26DESCRIPTION 27----------- 28 29Manage the set of repositories ("remotes") whose branches you track. 30 31 32OPTIONS 33------- 34 35-v:: 36--verbose:: 37 Be a little more verbose and show remote url after name. 38 For promisor remotes, also show which filters (`blob:none` etc.) 39 are configured. 40 NOTE: This must be placed between `remote` and subcommand. 41 42 43COMMANDS 44-------- 45 46With no arguments, shows a list of existing remotes. Several 47subcommands are available to perform operations on the remotes. 48 49'add':: 50 51Add a remote named <name> for the repository at 52<URL>. The command `git fetch <name>` can then be used to create and 53update remote-tracking branches <name>/<branch>. 54+ 55With `-f` option, `git fetch <name>` is run immediately after 56the remote information is set up. 57+ 58With `--tags` option, `git fetch <name>` imports every tag from the 59remote repository. 60+ 61With `--no-tags` option, `git fetch <name>` does not import tags from 62the remote repository. 63+ 64By default, only tags on fetched branches are imported 65(see linkgit:git-fetch[1]). 66+ 67With `-t <branch>` option, instead of the default glob 68refspec for the remote to track all branches under 69the `refs/remotes/<name>/` namespace, a refspec to track only `<branch>` 70is created. You can give more than one `-t <branch>` to track 71multiple branches without grabbing all branches. 72+ 73With `-m <master>` option, a symbolic-ref `refs/remotes/<name>/HEAD` is set 74up to point at remote's `<master>` branch. See also the set-head command. 75+ 76When a fetch mirror is created with `--mirror=fetch`, the refs will not 77be stored in the 'refs/remotes/' namespace, but rather everything in 78'refs/' on the remote will be directly mirrored into 'refs/' in the 79local repository. This option only makes sense in bare repositories, 80because a fetch would overwrite any local commits. 81+ 82When a push mirror is created with `--mirror=push`, then `git push` 83will always behave as if `--mirror` was passed. 84 85'rename':: 86 87Rename the remote named <old> to <new>. All remote-tracking branches and 88configuration settings for the remote are updated. 89+ 90In case <old> and <new> are the same, and <old> is a file under 91`$GIT_DIR/remotes` or `$GIT_DIR/branches`, the remote is converted to 92the configuration file format. 93 94'remove':: 95'rm':: 96 97Remove the remote named <name>. All remote-tracking branches and 98configuration settings for the remote are removed. 99 100'set-head':: 101 102Sets or deletes the default branch (i.e. the target of the 103symbolic-ref `refs/remotes/<name>/HEAD`) for 104the named remote. Having a default branch for a remote is not required, 105but allows the name of the remote to be specified in lieu of a specific 106branch. For example, if the default branch for `origin` is set to 107`master`, then `origin` may be specified wherever you would normally 108specify `origin/master`. 109+ 110With `-d` or `--delete`, the symbolic ref `refs/remotes/<name>/HEAD` is deleted. 111+ 112With `-a` or `--auto`, the remote is queried to determine its `HEAD`, then the 113symbolic-ref `refs/remotes/<name>/HEAD` is set to the same branch. e.g., if the remote 114`HEAD` is pointed at `next`, `git remote set-head origin -a` will set 115the symbolic-ref `refs/remotes/origin/HEAD` to `refs/remotes/origin/next`. This will 116only work if `refs/remotes/origin/next` already exists; if not it must be 117fetched first. 118+ 119Use `<branch>` to set the symbolic-ref `refs/remotes/<name>/HEAD` explicitly. e.g., `git 120remote set-head origin master` will set the symbolic-ref `refs/remotes/origin/HEAD` to 121`refs/remotes/origin/master`. This will only work if 122`refs/remotes/origin/master` already exists; if not it must be fetched first. 123+ 124 125'set-branches':: 126 127Changes the list of branches tracked by the named remote. 128This can be used to track a subset of the available remote branches 129after the initial setup for a remote. 130+ 131The named branches will be interpreted as if specified with the 132`-t` option on the `git remote add` command line. 133+ 134With `--add`, instead of replacing the list of currently tracked 135branches, adds to that list. 136 137'get-url':: 138 139Retrieves the URLs for a remote. Configurations for `insteadOf` and 140`pushInsteadOf` are expanded here. By default, only the first URL is listed. 141+ 142With `--push`, push URLs are queried rather than fetch URLs. 143+ 144With `--all`, all URLs for the remote will be listed. 145 146'set-url':: 147 148Changes URLs for the remote. Sets first URL for remote <name> that matches 149regex <oldurl> (first URL if no <oldurl> is given) to <newurl>. If 150<oldurl> doesn't match any URL, an error occurs and nothing is changed. 151+ 152With `--push`, push URLs are manipulated instead of fetch URLs. 153+ 154With `--add`, instead of changing existing URLs, new URL is added. 155+ 156With `--delete`, instead of changing existing URLs, all URLs matching 157regex <URL> are deleted for remote <name>. Trying to delete all 158non-push URLs is an error. 159+ 160Note that the push URL and the fetch URL, even though they can 161be set differently, must still refer to the same place. What you 162pushed to the push URL should be what you would see if you 163immediately fetched from the fetch URL. If you are trying to 164fetch from one place (e.g. your upstream) and push to another (e.g. 165your publishing repository), use two separate remotes. 166 167 168'show':: 169 170Gives some information about the remote <name>. 171+ 172With `-n` option, the remote heads are not queried first with 173`git ls-remote <name>`; cached information is used instead. 174 175'prune':: 176 177Deletes stale references associated with <name>. By default, stale 178remote-tracking branches under <name> are deleted, but depending on 179global configuration and the configuration of the remote we might even 180prune local tags that haven't been pushed there. Equivalent to `git 181fetch --prune <name>`, except that no new references will be fetched. 182+ 183See the PRUNING section of linkgit:git-fetch[1] for what it'll prune 184depending on various configuration. 185+ 186With `--dry-run` option, report what branches would be pruned, but do not 187actually prune them. 188 189'update':: 190 191Fetch updates for remotes or remote groups in the repository as defined by 192`remotes.<group>`. If neither group nor remote is specified on the command line, 193the configuration parameter remotes.default will be used; if 194remotes.default is not defined, all remotes which do not have the 195configuration parameter `remote.<name>.skipDefaultUpdate` set to true will 196be updated. (See linkgit:git-config[1]). 197+ 198With `--prune` option, run pruning against all the remotes that are updated. 199 200 201DISCUSSION 202---------- 203 204The remote configuration is achieved using the `remote.origin.url` and 205`remote.origin.fetch` configuration variables. (See 206linkgit:git-config[1]). 207 208EXIT STATUS 209----------- 210 211On success, the exit status is `0`. 212 213When subcommands such as 'add', 'rename', and 'remove' can't find the 214remote in question, the exit status is `2`. When the remote already 215exists, the exit status is `3`. 216 217On any other error, the exit status may be any other non-zero value. 218 219EXAMPLES 220-------- 221 222* Add a new remote, fetch, and check out a branch from it 223+ 224------------ 225$ git remote 226origin 227$ git branch -r 228 origin/HEAD -> origin/master 229 origin/master 230$ git remote add staging git://git.kernel.org/.../gregkh/staging.git 231$ git remote 232origin 233staging 234$ git fetch staging 235... 236From git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging 237 * [new branch] master -> staging/master 238 * [new branch] staging-linus -> staging/staging-linus 239 * [new branch] staging-next -> staging/staging-next 240$ git branch -r 241 origin/HEAD -> origin/master 242 origin/master 243 staging/master 244 staging/staging-linus 245 staging/staging-next 246$ git switch -c staging staging/master 247... 248------------ 249 250* Imitate 'git clone' but track only selected branches 251+ 252------------ 253$ mkdir project.git 254$ cd project.git 255$ git init 256$ git remote add -f -t master -m master origin git://example.com/git.git/ 257$ git merge origin 258------------ 259 260 261SEE ALSO 262-------- 263linkgit:git-fetch[1] 264linkgit:git-branch[1] 265linkgit:git-config[1] 266 267GIT 268--- 269Part of the linkgit:git[1] suite