This is an old revision of the document!
How to add, use and delete remotes, using Linux kernel source repo as an example.
Currently one remote:
$ git remote -v origin https://github.com/torvalds/linux.git (fetch) origin https://github.com/torvalds/linux.git (push) $
Query linux-next
before adding it as a remote:
$ git ls-remote https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
Add as a new remote with name ln
:
$ git remote add ln https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
There are no new branches yet:
$ git branch -a * master remotes/origin/HEAD -> origin/master remotes/origin/master $
But we have a new registered remote:
$ git remote -v ln https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (fetch) ln https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git (push) origin https://github.com/torvalds/linux (fetch) origin https://github.com/torvalds/linux (push) $
Count the current objects:
$ git count-objects -v count: 0 size: 0 in-pack: 6542717 packs: 1 size-pack: 2684971 prune-packable: 0 garbage: 0 size-garbage: 0 $
Fetch:
$ git fetch ln remote: Counting objects: 43368, done. remote: Compressing objects: 100% (16663/16663), done. remote: Total 43368 (delta 32248), reused 36955 (delta 26665) Receiving objects: 100% (43368/43368), 36.62 MiB | 23.38 MiB/s, done. Resolving deltas: 100% (32248/32248), done. From https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next * [new branch] akpm -> ln/akpm * [new branch] akpm-base -> ln/akpm-base * [new branch] master -> ln/master * [new branch] pending-fixes -> ln/pending-fixes * [new branch] stable -> ln/stable * [new tag] next-20190306 -> next-20190306 $
Count objects again:
$ git count-objects -v count: 0 size: 0 in-pack: 6586085 packs: 2 size-pack: 2723660 prune-packable: 0 garbage: 0 size-garbage: 0 $