本文介绍了将Git用于多个开发位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在我的开发流程中使用git。我正在使用Eclipse Juno。
我来自CVS,但从分布式VCS中看到很多好处。
我正在阅读Pro Git的书,已经阅读了相当多的内容开始使用它,但不知怎的,某些东西不能按照我认为应该的方式工作。
我在单机上做得很好,但当我做远程存储库同步时失败。



这就是我想要实现的:

>

我有两个PC-s,HOME&工作。我想在两台PC上开发,所以选择git来同步它们。
我在THUMB驱动器上创建了存储库,并将其克隆在HOME& WORK。



现在,我想在HOME或WORK上开发,在本地提交,与THUMB同步,然后与另一台PC(HOME或WORK)同步。 p>

我应该发布什么命令来执行此操作? (例如WORK - > THUMB - > HOME)

解决方案

基本工作流程在本地提交使用:

  $ git add。 
$ git commit -m提交消息

直到完成,然后:

 #将'master'分支推送到'thumb'存储库
$ git push thumb master

现在将拇指驱动器切换到另一个电脑,然后:

 #从'thumb'驱动器拉入您的本地仓库
$ git pull thumb master


I want to utilize git in my development workflow. I'm using Eclipse Juno.I'm coming from CVS, but see lots of benefits from distributed VCS.I'm reading Pro Git book, have read quite bit of it to start using it, but somehow something does not work the way I think it should to.I'm doing well with it on single machine, but fail when I do remote repository sync.

This is what I want to achieve:

I have two PC-s, HOME & WORK. I want to develop on both PC, so chose git to sync them as well.I created repository on the THUMB drive, and cloned it on HOME & WORK.

now, I want to develop on either HOME or WORK, commit locally, sync with THUMB, and then sync with another PC (HOME or WORK).

what commands should I issue to do this? (for example WORK -> THUMB -> HOME)

解决方案

Basic workflow is commit locally using:

$ git add .
$ git commit -m "Commit message"

Until done, then:

# Push the 'master' branch to the 'thumb' repository
$ git push thumb master

Now switch the thumb drive to the other pc and then:

# Pull from the 'thumb' drive into your local repo
$ git pull thumb master

这篇关于将Git用于多个开发位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 00:52