0

enter image description here

Basically I am trying to figure out how I can work seamlessly on both my laptop and desktop. So, I start off on my laptop and make a blank html page. I push that change to github. I then sit down at my desktop, clone it, and then start a new branch called crazy_idea, do some crazy stuff. Push it. Now I want to go get some coffee so I take my laptop with me down the street. How do I get the changes that I made on my desktop?

I have tried this scenario already using $ git fetch git@github.com:SpencerCooley/sandbox.git crazy_idea , then $git checkout crazy_idea, but when I look at the code, it looks exactly the same as it did before I did the fetch. When I look at the actual code on my github account I can see the changes I made so I know that my pushes are successful. I think I am misunderstanding what fetch does. I thought it was supposed to pretty much bring down all of the latest changes without merging. I would really appreciate anyone's insight.

Spencer Cooley
  • 8,471
  • 16
  • 48
  • 63

2 Answers2

1

If you already have the repo on the second computer, just fetch the remote. That will bring in all the remote branches. If you don't have the repo, then clone, again that brings down everything. Once you have everything in the local repo you want to merge or create a local branch to access the new stuff.

You should probably take an evening and sit down with http://gitref.org/ so that you understand all the stuff you need for working with git on a day-to-day basis.

Tekkub
  • 30,739
  • 2
  • 30
  • 20
  • I think where I was going wrong before was that I was fetching this git@github.com:SpencerCooley/sandbox.git instead of just writing the remote name, in this case 'origin'. Everything makes a lot more sense now and it is working how I was imaging it should have. – Spencer Cooley Sep 18 '11 at 03:18
  • toooo many pending edits like always. Here's a linkrot fix: The latest working archival link: https://web.archive.org/web/20170608171030/http://gitref.org/ – user8395964 Aug 08 '23 at 20:31
0

I suggest

git clone --mirror git://....

See also

Community
  • 1
  • 1
sehe
  • 374,641
  • 47
  • 450
  • 633
  • You don't want to use `--mirror` unless you are trying to create exactly that, a mirror. It sounds like he just wants to bring stuff into his local copy. – Tekkub Sep 18 '11 at 02:04