如何从两个系统工作在同一个github repo上? [英] How to work on same github repo from two systems?

查看:128
本文介绍了如何从两个系统工作在同一个github repo上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一整天都在多个系统上工作。我一直在试图找出在两个系统之间共享当前工作目录的策略。

该代码作为私人回购托管在Github上。我正在考虑在Dropbox中使用这样的裸回购:

  Github 
|
Dropbox(裸回购)
/ \
台式机笔记本电脑

我试图避免在我的回购库中存在大量虚假签入,以便代码在两个系统之间共享。我测试了这一点,它似乎工作分享代码,但我认为所有的签到仍然会堆积在git日志中,当我不得不从dropbox推到github时。



所以我的问题:


  1. 有没有办法编辑提交(即时想像的东西像压扁一堆提交到一个)之前推从保管箱裸回购github?

  2. 我应该将工作目录放入Dropbox(从github克隆)然后使用那里的代码吗?


解决方案

完全跳过Dropbox。相反,当您准备合并到 master 时,使用主题分支进行工作,然后 rebase 或以其他方式改善您的历史记录

工作流程如下所示:


  1. 获取敦促编写一个功能。使它成为主题分支: git checkout -B< topic> master

  2. < topic> 之外的代码。在任何你想要的状态下随时提交。
  3. 在日/会话结束时,推送到github: git push origin < topic>

  4. 跳到另一台机器时,结帐< topic> 并跟踪它: git checkout --track origin /< topic> git pull origin< topic> 它已签出。

  5. 重复步骤2-3,直到完成该主题。

你已经准备好与 master production 合并,使用 git rebase -i < topic> 一个逻辑的,可调试的,可维护的历史记录。


I work on multiple systems throughout the day. I've been trying to figure out a strategy to sharing my current working directory between the two systems.

The code is hosted on Github as a private repo. I was thinking of using a bare repo in dropbox like this:

    Github
       |
   Dropbox(bare repo)
     /      \
  Desktop   Laptop

I'm trying to avoid having tons of bogus checkins in my repo just so that the code is shared between the two systems. I tested this out, and it seemed to work to share code, but I'm thinking all the checkins will still pile up in the git log when i have to inevitably push from dropbox to github.

So my questions:

  1. Would there be a way to edit the commits (im thinking something like squashing a bunch of commits into one) before pushing from the dropbox bare repo to github?
  2. Should I be just putting the working directory into Dropbox (clone from github) and then using the code from there?

解决方案

Skip Dropbox entirely. Instead, use topic branches for work in progress, then rebase or otherwise improve your history when you're ready to merge to master.

The workflow would look something like this:

  1. Get the urge to code a feature. Make it a topic branch: git checkout -B <topic> master
  2. Code away on <topic>. Commit as often as you'd like, in whatever state you'd like.
  3. At the end of the day / session, push to github: git push origin <topic>
  4. When hopping to the other machine, checkout <topic> and track it: git checkout --track origin/<topic> or git pull origin <topic> if you already have it checked out.
  5. Repeat steps 2-3 until that topic is done.

When you're ready to merge with master or production, use git rebase -i to give <topic> a logical, debuggable, maintainable history.

这篇关于如何从两个系统工作在同一个github repo上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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