D
D
Denis Karimov2015-01-18 02:17:03
git
Denis Karimov, 2015-01-18 02:17:03

PHPStorm + GIT. How to set up ignore?

Hello! Wrapped up with ignoring files. I don’t remember how many weekends I killed for analysis. Generally. such a system:
There was a need to create a test subsite and work on it. I created a bare repository on BitBucket and cloned it into the PHPStorm project. In the folder with the project, I filled in the archive of the current site. Before making the first commit with all the files, I set up .gitignore . After setting up, I write the command:
git add .
And, oh miracle! GIT ignores adding ignored files. To celebrate, I make the first commit. Now it seems that there is only a little left - to remove the counters and online chat codes so as not to strain Yandex and the call center, as well as connect to the server via SFTP and change the configs. However, when editing files that I previously wrote to ignore (and they are not even uploaded to the repository), they are marked as changed and fly away when they are committed to the repository.
And I noticed that this is the case with all files. Elementary: there is a line in .gitignore :
.htaccess
And it was not filled in at the first commit. However, if I undertake to change it, it is marked as modified and flies to the repository.
What's the trouble? Is there really no way to have files in the site folder that you would never have to worry about, that they would fly into the repository? My project is connected via SFTP to the server, it would be convenient for me to send even pictures through it, but the only way to prevent all this from getting into the repository is to store in the project only those files that are in the repository and that do not affect the operation of the main site.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2015-01-18
@trixden

If the file is already under control (was previously added to the repository), then .gitignore will not work on it. Which, in fact, is logical.
There are two options:
- delete file -> commit -> add to .gitignore -> check in file
- remove from index ( git update-index --assume-unchanged your-file) -> add to .gitignore

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question