简体   繁体   English

如何使用 git 控制修改以使用远程服务器和本地服务器

[英]How to control modifications to work with a remote server and a local server using git

I am doing a very simple project with HTML, CSS and Javascript.我正在用 HTML、CSS 和 Javascript 做一个非常简单的项目。 I have to load some text fonts that are stored directly on the server with a different folder structure.我必须加载一些文本 fonts ,它们直接存储在服务器上,具有不同的文件夹结构。 So when developing locally on my computer I am using the sources directly from a very simple top folder, something like this:因此,当在我的计算机上进行本地开发时,我直接从一个非常简单的顶级文件夹中使用源代码,如下所示:

@font-face {
    font-family: Myfont;
    src: url("./fonts/font.otf");
}

But when I have to deliver the project I must replace it with something like:但是当我必须交付项目时,我必须将其替换为:

@font-face{
    font-family: Myfont;
    src:url("./FrontAPP/Banner/BannerFixed/Fonts/font.otf");
}

Is there a way for git to handle these changes, something like a production version and a development version without using branches ? git 有没有办法处理这些更改,比如不使用分支的生产版本和开发版本

Many things.很多东西。

First, you should check that your font is available on CDNs such as Google Fonts .首先,您应该检查您的字体在 CDN 上是否可用,例如Google Fonts

Next, why your fonts have to be in a different folder in development and production mode?接下来,为什么您的 fonts 在开发和生产模式下必须在不同的文件夹中? It'll be easiest to keep your development structure for the production.保持生产的开发结构是最容易的。 This is usually the way to do it.这通常是这样做的方法。

Finally, git doesn't use 'dev' and 'prod' version, the only way to create it is for example to create a develop branch for development version and the default master branch for production version最后,git 不使用 'dev' 和 'prod' 版本,创建它的唯一方法是例如为开发版本创建一个develop分支,为生产版本创建默认master分支

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM