R
R
Robin Alikhanov2022-01-17 15:36:43
git
Robin Alikhanov, 2022-01-17 15:36:43

How to ignore a .gitignore file?

In general, I have such a situation in my project, there are 3 files that need to be ignored for a remote repo when pushing.
You say put it in .gitignore but the .gitignore file itself will also spill into the master and everyone will have this configuration. You will say dot git add the file name, but if there are 10 of them and all the names, writing is also a chore. In general, how to ignore three files in a project or ignore .gitignore itself for a remote repo

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey delphinpro, 2022-01-17
@delphinpro

I understand correctly that the goal is to exclude some files that you only need locally, but have you already thought of the .gitignore file yourself?
It would be more convenient for me to still have a .gitignore file in the project (you probably have it).
Put such files in a separate folder, which you add to ignore.
But if you still don’t want to touch anything, then you can use the global ignore list.
Open file %USERPROFILE%/.gitconfig
Add line to core section

[core]
  excludesfile = C:\\path_to\\.gitignore

Create a file in the specified location and write what you need there.
This file will apply to all repositories opened on your computer.
You can use the console to add a global ignore list to the config
git config --global core.excludesFile "%USERPROFILE%\.gitignore"

S
Sergio, 2022-01-18
@sergiodev

Add these files to .git/info/exclude
https://docs.github.com/en/get-started/getting-sta...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question