同步文件而不提交? [英] sync files without committing?

查看:62
本文介绍了同步文件而不提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个正在处理的项目,并进行了以下设置:一台带有git存储库的服务器,一台台式机和一台笔记本电脑.

I have a project I'm working on and have the following set up : one server with my git repos, one desktop pc and a laptop.

我有时在台式机上,有时在笔记本电脑上从事项目.

I work on my project sometimes on the desktop, sometimes on my laptop.

如何在不将更改提交到服务器的情况下在台式机和笔记本电脑之间同步文件?

How can I sync my files between the desktop pc and the laptop without commiting changes to the server ?

推荐答案

您可以或多或少地直接在PC和笔记本电脑等客户端"之间进行拉动.传输可以是直接连接,例如SSH或HTTP.但是,您也可以在外部媒体上使用另一个存储库,该存储库可以是USB记忆棒,外部硬盘驱动器甚至是Dropbox之类的服务.

You can more or less directly pull and push between your "clients", i.e. PC and laptop. The transport may be a direct connection like SSH or HTTP. But you can also use another repository on external media, that may be a USB stick, an external hard drive or even a service like Dropbox.

这样,您的工作流程将如下所示:

That way your workflow could look like this:

  1. 在笔记本电脑上进行更改
  2. 在笔记本电脑上提交更改
  3. 将提交提交到USB记忆棒上的存储库
  4. 将USB闪存中的提交拖到PC上的存储库中
  5. 进行更多更改
  6. 提交它们-如果您希望更改是原子的,也可以修改其他提交
  7. 将最终提交提交到服务器上的存储库

请注意,在将更改推送到另一个存储库之前,始终需要在本地提交更改.似乎您来自另一个SCM系统(例如Subversion),其中提交始终表示使更改在服务器上以及所有人中可见". Git的工作原理与众不同,提交仅在推送之前是本地的.

Be aware that you'll always need to commit your changes locally before you can push them to another repository. It seems like you come from another SCM system like Subversion where committing always means "make the changes visible on the server and for everyone". Git works different, commits are only local before you push them.

这篇关于同步文件而不提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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