使用2台笔记本电脑的git,没有裸回购 [英] Working with git from 2 laptops with no bare repo

查看:88
本文介绍了使用2台笔记本电脑的git,没有裸回购的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始在我的第一台笔记本电脑项目。 git init,并开始工作。
明天我要去休假。我想带着我的小笔记本电脑。



并且可以随时处理项目。



我通过ssh从更大的笔记本电脑克隆存储库(git clone ssh://地址)

当我回来时,将较小笔记本电脑的更改推向更大笔记本电脑的最佳方式是什么?



在更大的笔记本电脑中没有裸回购。



我想在稍后的笔记本电脑上使用该回购,所以我必须这样做很清楚。

解决方案

不要使用push;当您回来时,在您的其他笔记本电脑上将您的旅行笔记本电脑存储库作为远程存储库添加到回购站中,并取消更改。 $ b

手册: / p>


请注意,推送的目标通常是裸仓库。您也可以推送到具有检出工作树的存储库,但工作树不会通过推送进行更新。这可能会导致意想不到的结果,如果你推到的分支是当前签出的分支!



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.

解决方案

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!

这篇关于使用2台笔记本电脑的git,没有裸回购的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆