【问题标题】:GIT workspace synced in multiple systemGIT 工作空间在多个系统中同步
【发布时间】:2016-03-20 16:21:52
【问题描述】:

GIT 工作空间在多个系统中同步

是否可以在多个系统中拥有相同的 git 工作区。

例如,我的办公系统中有一个工作区,我想回家后在我的个人笔记本电脑上执行任务。

我在工作区中所做的任何更改,添加、删除、编辑 java/class 文件。

会自动反映到其他系统

【问题讨论】:

  • 自动是个坏主意。就像你是两个开发人员而不是一个开发人员一样工作。

标签: eclipse git synchronization workspace


【解决方案1】:

即使您的代码不完整,您也可以使用 git、使用分支并在每天结束时将代码提交到所需的分支。

回家后获取更改git fetch --all --prune,您可以从停止工作的位置继续工作。

完成后,您可以通过简单的提交或使用 commit --ammend 完成后,使用 git squash 将提交日志对齐到您想要的位置。


要执行 git squash,请按照以下步骤操作:

// X is the number of commits you wish to squash, in your case 6
git rebase -i HEAD~X

压缩提交后 - 选择 s 进行压缩 = 它将所有提交合并为一个提交。


你也有 --root 标志以备不时之需

试试:git rebase -i --root

--root

Rebase all commits reachable from <branch>, instead of limiting them with
an <upstream>.

This allows you to rebase the root commit(s) on a branch.  
When used with --onto, it will skip changes already contained in `<newbase>`   
(instead of `<upstream>`) whereas without --onto it will operate on every 
change. When used together with both --onto and --preserve-merges, all root 
commits will be rewritten to have `<newbase>` as parent instead.`

【讨论】:

    猜你喜欢
    • 2021-03-13
    • 2017-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-07-30
    • 1970-01-01
    • 2017-02-21
    • 2018-09-29
    相关资源
    最近更新 更多