From ff628700ec6fc0af1832d700e821d958fe303fa8 Mon Sep 17 00:00:00 2001 From: Asocia Date: Wed, 30 Jun 2021 13:20:23 +0300 Subject: [PATCH] Add a note about remotes --- git/notes-from-pro-git-book.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/git/notes-from-pro-git-book.md b/git/notes-from-pro-git-book.md index f5fd7f4..0d91df4 100644 --- a/git/notes-from-pro-git-book.md +++ b/git/notes-from-pro-git-book.md @@ -26,3 +26,18 @@ Another really helpful filter is the -S option (colloquially referred to as Git ``` git log -S function_name ``` + + +- Adding remotes and fetching them + + +We’ve mentioned and given some demonstrations of how the git clone command implicitly adds the origin remote for you. Here’s how to add a new remote explicitly. To add a new remote Git repository as a shortname you can reference easily, run git remote add : + +``` +$ git remote -v +$ git remote add pb https://github.com/paulboone/ticgit +$ git remote -v +$ git fetch pb +``` +Paul’s master branch is now accessible locally as pb/master — you can merge it into one of your branches, or you can check out a local branch at that point if you want to inspect it. +