tags:

views:

61

answers:

4

I've started project in my first laptop. git init, and start working. Tomorrow i'm going to vacations. I want to take with me my smaller laptop.

And work with project from time to time.

I cloned repository via ssh from bigger laptop (git clone ssh://adress)

And when i will back, what is the best way to push changes from smaller laptop to the bigger one?

There is no bare repo in bigger laptop.

And i want to work with that repo on the bigger laptop later, so i have to do this clear.

A: 

just:

git push

If you created the repo on small laptop from big laptop over ssh from a user that owned the repo on big laptop, and big laptop is running an ssh service, you'll be fine.

You can supply the argument to git push of the bigger laptop and repo dir if you want, but it should already be your origin.

If you do it this way, just remember to take appropriate action to update your tree on the big laptop when you go back to it.

jer
+4  A: 

Don't use push; when you get back, add your travel laptop repository as a remote in the repo on your other laptop, and pull the changes.

From the manual:

Note that the target of a "push" is normally a bare repository. You can also push to a repository that has a checked-out working tree, but the working tree will not be updated by the push. This may lead to unexpected results if the branch you push to is the currently checked-out branch!

mkarasek
+1  A: 

On the big laptop machine, you should do a "git pull", pulling changes from the small laptop into the big one.

While you may do "git push" from the small laptop, but because the repository on the big laptop is not a bare one, you would also have to do a "git checkout" or "git reset" on the big laptop to sync with the pushed changes, with the possibility of encountering conflicts if there are modifications to the big laptop repository.

5ound
+2  A: 

Adding to mkarasek and 5ound ....

If this is a situation you encounter regularly, a good idea would be to keep bare repos on your small laptop and push/pull from that regularly using the ssh protocol.

Pushing/Pulling from repos with a working branch checked out can easily lead to conflicts and management headaches.

Keeping a copy of a bare repo on your small laptop (assumed authoritative) will give you the flexibility to push to it using the file:// protocol when you're not at home. When you return home and have the small laptop on your LAN, simply do a git pull using the ssh protocol.

Bryce