grayghostvisuals/practice-git

Fetching a remote branch not present/avail. locally.

grayghostvisuals opened this issue · 3 comments

These are the steps to fetch a remote branch that is not locally available for your machine.

grayghostvisuals ✭ GrayGhostVisualsMacBookAir.local  ~/Sites/Effeckt.css on master
$ g fetch upstream
remote: Counting objects: 18, done.
remote: Compressing objects: 100% (12/12), done.
remote: Total 14 (delta 6), reused 6 (delta 2)
Unpacking objects: 100% (14/14), done.
From github.com:h5bp/Effeckt.css
 * [new branch]      gh-pages   -> upstream/gh-pages
 * [new branch]      master     -> upstream/master
grayghostvisuals ✭ GrayGhostVisualsMacBookAir.local  ~/Sites/Effeckt.css on master
$ g branch
* master
grayghostvisuals ✭ GrayGhostVisualsMacBookAir.local  ~/Sites/Effeckt.css on master
$ g checkout -b gh/pages upstream/gh-pages
Branch gh/pages set up to track remote branch gh-pages from upstream.
Switched to a new branch 'gh/pages'

There is also this little ditty about Jack and Diane

git fetch <remote> <rbranch>:<lbranch> 
git checkout <lbranch>

looks like this...

GrayGhost ✱ grayghostvisualsmacmini.local  ~/httpd/directory-name on r4
$ git fetch origin deploy:deploy
remote: Counting objects: 75, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 43 (delta 25), reused 33 (delta 18)
Unpacking objects: 100% (43/43), done.
From github.com:repo-owner/remo-name
 * [new branch]      deploy     -> deploy

Also works too

git fetch
git checkout -t <remote>/<branch>
grayghostvisuals ✭ GrayGhostVisualsMacBookAir.local  ~/Sites/[repo] on master
$ g fetch origin
grayghostvisuals ✭ GrayGhostVisualsMacBookAir.local  ~/Sites/[repo] on master
$ git checkout -b public_site origin/public_site
Branch public_site set up to track remote branch public_site from origin.
Switched to a new branch 'public_site'