Git工作流程:在不推送公共回购的情况下在计算机之间共享代码 [英] Git Workflow: Share code between computers without pushing to public repo

查看:96
本文介绍了Git工作流程:在不推送公共回购的情况下在计算机之间共享代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一家使用Git进行版本控制的公司工作。我们使用托管回购服务(Beanstalk)作为我们的内部公共(我的意思是整个开发团队都可以访问)回购。我有两台通常用于编写代码的计算机。我喜欢使用Git的一些历史重写功能,特别是重新绑定和修改提交,但我真的不喜欢在将某些东西推送到已发布的分支之后使用它们。然而,我需要能够在这两台计算机之间共享代码,并且最好是别人。



我想要的是一种简单的方法来在两台电脑,而不必与其他人分享。我考虑过Airdrop(两台电脑都是Mac)和ssh。在利用git的分布式特性的同时,实现这一点的建议方式是什么?解析方案

你可以推,取,拉在机器之间自由地假设你有他们之间的ssh访问:

  git push computer2:projects / prog HEAD:tmp 

或者,如果您在computer2上:

  git pull computer1:projects / prog HEAD 

  git fetch computer1:prj / prog branch1:t1 
git fetch computer1:prj / prog branch2:t2
git merge t1 t2

  git fetch computer1:prj / prog branch1 branch2 branch3 
git merge FETCH_HEAD

等等...更多示例请参阅 git help fetch


I work at a company which uses Git for our version control. We're using a hosted repo service (Beanstalk) as our internal "public" (by that I mean accessible to the whole dev team) repo. I have two computers that I normally work on for writing code. I like using some of the history rewriting features of Git, specifically rebasing and amending commits, but I really don't like using them after I've pushed something to a published branch. Yet, I need to be able to share code between these two computers, and preferably no one else.

What I'd like is an easy way to share my code between the two computers, without having to share it with everyone else. I have considered Airdrop (both computers are Macs), and ssh. What would be the suggested way of achieving this, while taking advantage of git's distributed nature?

解决方案

You can push, fetch and pull between the machines freely assuming you have ssh access between them:

git push computer2:projects/prog HEAD:tmp

or, if you are on computer2:

git pull computer1:projects/prog HEAD

or

git fetch computer1:prj/prog branch1:t1
git fetch computer1:prj/prog branch2:t2
git merge t1 t2

or

git fetch computer1:prj/prog branch1 branch2 branch3
git merge FETCH_HEAD

and so on... See git help fetch for more examples.

这篇关于Git工作流程:在不推送公共回购的情况下在计算机之间共享代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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