This is an old revision of the document!
Overview
Discussion and demonstration of remote tracking branches and adding remotes.
ADD
$ git ls-remote [<remote>] $ git remote show <remote> $ git remote -v $ git remote prune
$ git fetch --all $ git branch -v $ git branch -vv $ git push origin thisbranch:thatbranch $ git push origin --delete <branchname>
$ git checkout --track origin/serverfix $ git checkout -b sf origin/serverfix $ git branch [-u|--set-upstream-to] origin/serverfix
Shorthand if you're on the master branch:
$ git merge origin/master
$ git merge @{upstream}
$ git merge @{u}
$ git fetch [-p|--prune]
Adding the "linux-next" remote
Based on the web page here, first verify that there is only one remote:
$ git remote origin $ git remote -v origin https://github.com/torvalds/linux.git (fetch) origin https://github.com/torvalds/linux.git (push) $
Add the remote with whatever meaningful name works for you:
$ git remote add ln \ > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git $
Verify you have a second 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.git (fetch) origin https://github.com/torvalds/linux.git (push) $
Now fetch the new content from the new remote:
$ git fetch [--tags] ln remote: Counting objects: 109900, done. remote: Compressing objects: 100% (19971/19971), done. remote: Total 109900 (delta 95864), reused 103738 (delta 89778) Receiving objects: 100% (109900/109900), 17.48 MiB | 1.14 MiB/s, done. Resolving deltas: 100% (95864/95864), completed with 4062 local objects. 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] stable -> ln/stable * [new tag] next-20171115 -> next-20171115 * [new tag] next-20171116 -> next-20171116 * [new tag] next-20171117 -> next-20171117 * [new tag] next-20171120 -> next-20171120 * [new tag] next-20171121 -> next-20171121 ... big snip ... $
List all remote branches in the object store:
$ git branch -r ln/akpm ln/akpm-base ln/master ln/stable origin/HEAD -> origin/master origin/master $
Start tracking:
$ git checkout -b lnmaster --track ln/master
git fetch prune
For Linux kernel:
$ git branch -r origin/HEAD -> origin/master origin/WIP-syscall origin/master origin/proc-cmdline $ git fetch --prune From https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux - [deleted] (none) -> origin/WIP-syscall - [deleted] (none) -> origin/proc-cmdline $ git branch -r origin/HEAD -> origin/master origin/master $