【问题标题】:How to exclude .gitignore rules only once?如何仅排除 .gitignore 规则一次?
【发布时间】:2022-01-07 12:01:11
【问题描述】:

在服务器(ubuntu 20)上初始化我的 laravel 8 应用程序我需要上传一些存储下的图像,这些图像被排除在外 来自 git 的 .gitignore 规则。

我根本不喜欢删除 .gitignore,但如果有办法只排除这些规则一次?

似乎有一些强制选项,但我如何使用它在本地运行命令:

git push -u origin master

在服务器上:

git pull origin master

?

我的根 .gitignore:

# These are some examples of commonly ignored file patterns.
# You should customize this list as applicable to your project.
# Learn more about .gitignore:
#     https://www.atlassian.com/git/tutorials/saving-changes/gitignore

# Node artifact files
node_modules/
dist/

# Compiled Java class files
*.class

# Compiled Python bytecode
*.py[cod]

# Log files
*.log

# Package files
*.jar

# Maven
target/
dist/

# JetBrains IDE
.idea/

# Unit test reports
TEST*.xml

# Generated by MacOS
.DS_Store

# Generated by Windows
Thumbs.db

# Applications
*.app
*.exe
*.war

# Large media files
*.mp4
*.tiff
*.avi
*.flv
*.mov
*.wmv


/public/js/laravel.app.js
/public/js/oneui.app.js
/public/js/tables_datatables.js
/public/css/oneui.css

composer.lock

package-lock.json

.env
vendor/
route_list.txt

哪种语法正确?

谢谢!

【问题讨论】:

  • 你能添加你的 .gitignore 文件吗?
  • 请检查我的根 .gitignore。你想看看其他的 .gitignore 吗?
  • 你的问题不太清楚。你还有一些 .gitignore 文件吗?
  • 可能在项目的子目录中有。但是现在我有了默认规则,即 /storage 下的文件不会被 git 推送/拉取。我只需要忽略这些规则一次

标签: laravel gitignore


【解决方案1】:

看起来像添加 -f 键一样:

git add -f storage/app/public/Photos/1/img-13.jpg

适用于我的情况

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-06-14
    • 1970-01-01
    • 2020-05-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多