在裸仓库中预览文件 [英] Preview files in a bare repository

查看:121
本文介绍了在裸仓库中预览文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在工作中,我们试图切换到Git,但遇到了一些问题(让我从一开始就说我是唯一一个在Git有基本经验的人,另一个同事在Subversion中使用过

我们的设想如下:


  • 我们有一个稳定项目所在的主目录,我们的项目经理可以根据需要查看站点和进行调试。这个主目录(我们称之为MAIN)也是所有开发者的源代码库。
  • 所有开发这个项目的开发者都在服务器上有一个子目录,在那里我们克隆MAIN,处理我们的改变并再次推到MAIN。我们也会从那里吸引对方的变化。



我们今天尝试这样做,但很快发现不推荐将其推送到非裸存储库master - > master。当我读到为什么时,这对我有意义。我发现一些解决方案,如果你想本身做主 - >主推(非裸回购),但他们都需要在原点执行各种命令(重新设置或从不同的分支合并)。就我所知,解决方案就是:将MAIN转换为裸存储库。但是,这意味着我们的PM不再能够查看该项目,因为没有工作目录。

解决这个问题的最佳方法是什么?我们是否设置了一个会自动导出裸主存储库的挂钩,以便我们可以查看这些文件?

额外的东西:随着时间的推移,MAIN将成为自己的一个克隆:我们有一个用于每个项目的默认模板,我认为克隆MAIN从默认的模板,然后添加到它的东西。这被认为是不好的做法?回到默认模板并不是必要的,但我们可能想要拉动错误修正。我们是否应该启动裸露的MAIN回购,并将默认模板复制/粘贴到它? 解决方案

建议设置为主存储器,就像你预见的那样,然后你可以使用诸如 Git Web ,一个问题跟踪器连接器(我知道 Redmine 可以连接到git) ,或本地克隆+纯git / tig /用于浏览它的任何git GUI。



或者,也可以安装本地 gitorius ,或托管 Github


At work, we are trying to switch to Git, but are encountering some problems (let me state from the beginning I'm the only one at work who has some basic experience with Git, another coworker has worked with Subversion in the past, but that's it).

We envision things as follows:

  • We have a main directory where stable projects are located and our project managers can review sites and debug if needed. This main directory (let's call it MAIN) is also the origin repository for all developers.
  • All developers working on the project have a subdirectory on the server where we clone MAIN, work on our changes and push to MAIN again. We pull each others changes from there as well.

We tried doing this today, but quickly noticed it is not recommended to push to a non-bare repository master -> master. This makes sense to me when I read why. I found some solutions if you want to per se do master -> master pushing (to a non-bare repo), but they all require executing various commands on the origin (either resetting or merging from a different branch). The solution then is, as far as I can tell: convert MAIN into a bare repository. However, this would mean that our PMs are no longer able to view the project, as there is no working directory.

What would be the best approach to solve this? Do we set up a hook that automatically exports the bare MAIN repository so we can view the files?

Extra thing: MAIN will become a clone on it's own over time: we have a default template that's used for every project, I thought it would be good practice to clone MAIN from the default template and then add stuff onto it. Is this considered bad practice? Pushing back to the default template is not necessary, however we might want to pull bugfixes. Should we just start the bare MAIN repo and copy/paste the default template into it?

解决方案

The recommended setting would be to make MAIN a bare repository, as you've foreseen, and then you can use something like Git Web, an issue tracker connector (I know Redmine can connect with git), or a local clone + plain git / tig / any git GUI for browsing it.

Or maybe a local gitorius installation, or hosting on Github.

这篇关于在裸仓库中预览文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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