K
K
Kirill Gorelov2018-05-24 09:36:02
git
Kirill Gorelov, 2018-05-24 09:36:02

Git Exclude files from commit?

Guys, such a question.
We have an online store and it has 1 million pictures. Added upload folder to gitignore. But there is another folder delete_file_old, it is also listed in gitignore, but all the same, files from it end up in the index.
If specifically on the example.
This is how we specify a folder, a piece of gitignore.
5b065c26a86a7658063781.png
We counted the number of files that will be added to git. (git count-objects -v )
5b065c83077c4993896140.png
We began to look at what files are added there (git log --name-only > ttt.txt)
The result of git log is written to a file, for convenience.
And we see that we have a lot of pictures, an example file:
delete_file_old/0183737bc93efeac6e02557f0bc69e68.png
delete_file_old/0183cadb700868ef1f14e0f1e9b89aa1.png
delete_file_old / 01858d6741c3a5aba027dd6071ec83d3.png
delete_file_old / 0186c5a343b8d06d60ef25fae88e6654.png
delete_file_old / 0186f3208b62c41dc0c8e2184ace1ee0.png
delete_file_old / 018718f866277cbd4bb82dfea5fea324.png
delete_file_old / 018735274f618858c33b6dac1bfcb91f.png
How do we fix it, if at all gitignore already added?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
LightAir, 2018-05-24
@LightAir

First you need gitignore and then the files.
Temporarily move delete_file_old, commit, then you can add them again.
Can be through

git rm -r --cached .
git add .
git commit -m ".gitignore"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question