跟踪本地Git仓库中的文件,但忽略远程文件 [英] Track files in local Git repo but ignore in remote

查看:93
本文介绍了跟踪本地Git仓库中的文件,但忽略远程文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以跟踪本地存储库中的文件夹和文件,但不能在远程存储器中进行跟踪,以便在推送更改时不会远程推送?原因是我使用Beanstalk来部署我在本地工作的网站。我的本地仓库包含用于插图和其他内容的文件夹,我希望能够跟踪本地的更改,但不希望最终进入生产服务器。

Is it possible to track folders and files in a local repo but not on a remote so that when you push changes, they don't get pushed remotely? The reason being is that I'm using Beanstalk to deploy a website I'm working on locally. My local repo contains folders for artwork and other content that I want to be able to keep track of changes locally for, but don't want to end up on the production server.

推荐答案

为您的图形创建单独的git仓库。把它作为主项目的一个子目录。将子文件夹添加到主库中的.gitignore。然后你就不必乱用子模块,但是你仍然可以版本化本地文件。

Create a separate git repo just for your graphics. Put it as a subdirectory in the main project. Add the subfolder to .gitignore in your main repo. Then you won't have to mess with submodules, but you can still version your local files.

mainrepo
|
|-- .git
|-- .gitignore (contains "graphicsrepo")
|-- graphicsrepo
|   |
|   |-- .git
|   \-- somefile.jpg
|
\-- html

这篇关于跟踪本地Git仓库中的文件,但忽略远程文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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