B
B
bormor2020-04-16 16:27:57
git
bormor, 2020-04-16 16:27:57

How in git to stop tracking changes in such and such a file, NOT adding it to .gitignore (i.e. keeping the original version in the repository)?

The project has a config file that each developer customizes for himself.

Adding it to .gitignore will remove the file from the repository and the new developer won't download it.
As a result, his project build will not start at all.

You need to save the original file in the repository.
Then, at the start of the build, the developer will receive messages about which lines in which files he needs to customize for himself.

How can I make sure that these changes are not tracked by Git?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Alexey Yarkov, 2020-04-16
@bormor

On the example of the .env file :
There is a file with environment variables that is used by the application and contains some data that should not be in the turnip. Then the guys do this:
1. Create a .env.dist file in the turnip , which, after cloning the turnip, is simply copied and renamed to .env
2. Write a sample config in it, but without critical data
3. Create a local .env
file 4. Add . env in .gitignore
Everything ))

D
Dmitry Shitskov, 2020-04-16
@Zarom

Adding it to .gitignore will remove the file from the repository

Not
You need to save the original file in the repository.

Need to push the file, then add it to .gitignore

D
Dmitry, 2020-04-16
@Compolomus

Add a file so that it is in the repository, then add it to ignore, the file in the turnip will still lie and will not be overwritten

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question