Search code examples
laravelgitignore

How to exclude .gitignore rules only once?


Make once init of my laravel 8 app on server(ubuntu 20) I need to upload some images under storage, which is excluded from git by .gitignore rules.

I do not like to remove .gitignore at all, but if there is a way to exclude these rules only once ?

Seems there is some force option, but how can I use it running command locally :

git push -u origin master

and on server :

git pull origin master

?

My root .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

Which is correct syntax ?

Thanks!


Solution

  • Looks like adding -f key like:

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

    works in my case