I think you don’t actually need to set ignore files in the .gitignore file. Since you don't want to push those files to the remote, but want to keep those files remotely, you can just not add them to the temporary storage area. Specifically, just git add的时候,别把那些文件addjust go in. However, this also has the disadvantage that you may encounter a situation where you cannot switch branches because there are always some modifications that have not been added to the staging area.
Your idea is very strange. Since you don’t need to worry about it after the first submission, then you don’t need to add it to the .gitignore file. Is your file constantly changing?
Using sparse checkout
sparse-checkout
Solved the problemAttached reference link link description
You can try to deceive yourself and pretend you can’t see it. .
In this case, you usually create one
config.ini.dist
for users to modifyI think you don’t actually need to set ignore files in the .gitignore file. Since you don't want to push those files to the remote, but want to keep those files remotely, you can just not add them to the temporary storage area. Specifically, just
git add
的时候,别把那些文件add
just go in. However, this also has the disadvantage that you may encounter a situation where you cannot switch branches because there are always some modifications that have not been added to the staging area.Your idea is very strange. Since you don’t need to worry about it after the first submission, then you don’t need to add it to the .gitignore file. Is your file constantly changing?
Just add the file name directly to gitignore, and then generate one online and you’re done. Why do you have to fix git? Didn't understand.
I have encountered this problem and haven’t found a solution yet. I guess there’s no way