Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
| git_remotes [2019/03/07 19:56] – [Adding the linux-next remote] rpjday | git_remotes [2019/04/04 03:23] (current) – removed rpjday | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Overview ===== | ||
| - | |||
| - | Discussion and demonstration of remote tracking branches and adding remotes. | ||
| - | |||
| - | ===== ADD ===== | ||
| - | |||
| - | < | ||
| - | $ git ls-remote [< | ||
| - | $ git remote show < | ||
| - | $ git remote -v | ||
| - | $ git remote prune | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | $ git fetch --all | ||
| - | $ git branch -v | ||
| - | $ git branch -vv | ||
| - | $ git push origin thisbranch: | ||
| - | $ git push origin --delete < | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | $ git checkout --track origin/ | ||
| - | $ git checkout -b sf origin/ | ||
| - | $ git branch [-u|--set-upstream-to] origin/ | ||
| - | </ | ||
| - | |||
| - | Shorthand if you're on the '' | ||
| - | |||
| - | < | ||
| - | $ git merge origin/ | ||
| - | $ git merge @{upstream} | ||
| - | $ git merge @{u} | ||
| - | </ | ||
| - | |||
| - | < | ||
| - | $ git fetch [-p|--prune] | ||
| - | </ | ||
| - | |||
| - | ===== Adding the " | ||
| - | |||
| - | Based on the web page [[https:// | ||
| - | |||
| - | < | ||
| - | $ git remote | ||
| - | origin | ||
| - | $ git remote -v | ||
| - | origin https:// | ||
| - | origin https:// | ||
| - | $ | ||
| - | </ | ||
| - | |||
| - | Add the remote with whatever meaningful name works for you: | ||
| - | |||
| - | < | ||
| - | $ git remote add ln \ | ||
| - | > https:// | ||
| - | $ | ||
| - | </ | ||
| - | |||
| - | Verify you have a second remote: | ||
| - | |||
| - | < | ||
| - | $ git remote -v | ||
| - | ln https:// | ||
| - | ln https:// | ||
| - | origin https:// | ||
| - | origin https:// | ||
| - | $ | ||
| - | </ | ||
| - | |||
| - | Now fetch the new content from the new remote: | ||
| - | |||
| - | < | ||
| - | $ git fetch [--tags] ln | ||
| - | remote: Counting objects: 109900, done. | ||
| - | remote: Compressing objects: 100% (19971/ | ||
| - | remote: Total 109900 (delta 95864), reused 103738 (delta 89778) | ||
| - | Receiving objects: 100% (109900/ | ||
| - | Resolving deltas: 100% (95864/ | ||
| - | From https:// | ||
| - | * [new branch] | ||
| - | * [new branch] | ||
| - | * [new branch] | ||
| - | * [new branch] | ||
| - | * [new tag] | ||
| - | * [new tag] | ||
| - | * [new tag] | ||
| - | * [new tag] | ||
| - | * [new tag] | ||
| - | ... big snip ... | ||
| - | $ | ||
| - | </ | ||
| - | |||
| - | List all remote branches in the object store: | ||
| - | |||
| - | < | ||
| - | $ git branch -r | ||
| - | ln/akpm | ||
| - | ln/ | ||
| - | ln/master | ||
| - | ln/stable | ||
| - | origin/HEAD -> origin/ | ||
| - | origin/ | ||
| - | $ | ||
| - | </ | ||
| - | |||
| - | Start tracking: | ||
| - | |||
| - | < | ||
| - | $ git checkout -b lnmaster --track ln/master | ||
| - | </ | ||
| - | |||
| - | ===== git fetch prune ===== | ||
| - | |||
| - | For Linux kernel: | ||
| - | |||
| - | < | ||
| - | $ git branch -r | ||
| - | origin/HEAD -> origin/ | ||
| - | origin/ | ||
| - | origin/ | ||
| - | origin/ | ||
| - | $ git fetch --prune | ||
| - | From https:// | ||
| - | - [deleted] | ||
| - | - [deleted] | ||
| - | $ git branch -r | ||
| - | origin/HEAD -> origin/ | ||
| - | origin/ | ||
| - | $ | ||
| - | </ | ||