工作流Git FTP用于具有潜在外部非git用户的旧项目 [英] Workflow Git FTP for old projects with potential external non-git users

查看:144
本文介绍了工作流Git FTP用于具有潜在外部非git用户的旧项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个旧的遗产项目,我偶尔会不定期地工作,我想集成一个git工作流程 - 主要是为了我,但可以选择在某种程度上进行协作


  1. 第一个问题是访问项目代码的唯一方法是(仅)ftp。
    提供程序没有提供shell访问。


  2. 第二个问题或约束是第三方可能会更改实时ftp上的文件服务器(我知道丑陋的),而不使用git,当我使用一些后挂式推送方法,这将破坏。不幸的是,教给外部用户一个git工作流是没有选择的,因为无知是幸福。


我真的想做的是以某种方式跟踪这些外部变化(2),并通过使用git来获益于我的开发工作流程。



想像一下,我没有碰到一个项目一段时间我回来了,我想看看已经做了什么。



但我真的很困惑我应该如何设置存储库。

解决方案

通过FTP进行Git部署的超级好的是 git -ftp 。不幸的是,它是一种方式,即它假定目的地文件只能由你更新(并且通过 git-ftp )。



所以对于你的情况,你必须在发生远程更改时创建一些合成的远程更改历史,唯一的方法是获取文件,然后手动创建它们之间的增量。所以,为了这个,我和@VonC—您必须将文件传回( rsync 如果不可用,那么google可以使用FTP协议本身来爬行远程层次结构的实用工具并且仅获取丢失/更新的最新文件),然后使更改被Git知道。



此进程可以在单独的分支或临时抛出中完成一个分支。基本上,您将一个分支从一个点上分支出来,您认为该代码表示​​上次上次查看远程文件的状态,然后在结帐上运行一个syncronization程序。 (请注意,这样的程序必须跟踪删除,也就是说,它必须删除在远端被删除的本地文件。)然后运行 git add --all。 使Git阶段提交所有更新的文件,所有删除,并添加所有当前未跟踪的文件。然后记录提交。此提交将实际表示对远程的更改。然后,您可以将此进一步的工作作为此状态。


I have a few old legacy projects on which I work occasionally from time to time, which i would like to integrate in a git workflow - mainly just for me, but it could be nice to have the option to collaborate on some level later.

  1. The first problem is that the only method of accessing the project's code is (s)ftp-only. There is no shell-access given by the provider.

  2. The second problem or contraint is that 3rd parties might change the files on the live ftp server (I know ugly) without using git at all, when i use some post-hook pushing method, this would break. Unfortunately, teaching those external users a git workflow is no option as ignorance is bliss.

What I really would like to do is to somehow keep track of those external changes (2) and benefit for my development workflow by using git.

Imagine I have not touched a project for a while and when i come back i'd like to see what has been done.

But I'm really confused on how and where I should setup repositories.

解决方案

A super-nice to do Git deployment over FTP is git-ftp. Unfortunately, it's one way, i.e. it assumes the destination files are only ever updated by you (and via git-ftp).

So for your case you'd have to create some sort of synthetic history of remote changes when they occur, and the only way to do that is to get the files and then manually create "the delta" between them. So, for this, I'm with @VonC — you'd have to transfer the files back (rsync does this efficienly, if it's not available, google for an utility which is able to crawl the remote hierarchy using the FTP protocol itself and fetch only the missing/more recent files) and then make the changes be known to Git.

This process may be either done on a separate branch or on a temporary throw-away branch. Basically you fork a branch off a point you think represented the state of remote files last time you looked at them and then run a syncronization program over the checkout. (Note that such a program have to track removals, that is, it has to remove files locally which were removed at the remote side.) Then run git add --all . to make Git stage for commit all updated files, all removals and also add all the presently untracked files. Then record a commit. This commit will actually represent the changes made to the remote. You can then base your further work on this state.

这篇关于工作流Git FTP用于具有潜在外部非git用户的旧项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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