简体   繁体   中英

git push and pull branches

This question has been asked a few times but i haven't found my specific use case: I do have a nas which has gitosis and serves as a git master. I have a laptop and a desktop, on the laptop I do have a branch sandbox which I want to share via the nas on to the desktop. I tried git

git push sandbox : sandbox (: sandbox being redundant) 

which failed. Checking out sandbox and doing

git push origin HEAD

reports:

* [new branch]      HEAD -> sandbox

Now on the desktop I do:

git remote show origin

and I see the new branch:

Remote branches:
master tracked
sandbox new (next fetch will store in remotes/origin)

That's promising so now I want to pull the remote branch sandbox into my workspace on the desktop with:

git fetch origin sandbox (in the master branch)

it logs:

 * branch            sandbox      -> FETCH_HEAD

but branch sandbox is not created when I show the branches. Is there something trivial i'm missing? I also tried pulling but that also does not work as expected. regards, Jeroen.

sandbox should be listed if you do a:

git branch --all

You need to checkout said remote branch to track it locally

git checkout --track origin/sandbox

Then a simple git branch would show that branch.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM