demonguy
demonguy

Reputation: 2017

What if .gitignore ignore itself? Does it affect on "git fetch"?

Suppose this scene

  1. A git server of some sources codes and some elf binary files
  2. This server has no .gitignore file.
  3. I don't know what new binary file will be added to the git server
  4. Every time i build the codes, it will create some new elf binary files.
  5. Since there is no .gitignore file, after building, i can't git fetch or git pull because git will promopts changes not committed

So i want to solve this, but i can't just make a .gitignore with *.elf because there are some elf files released with git server.

Of course i can't tell .gitignore don't ignore these elf files released with git server because there may be some new elf binary files added to git server in the future

So, what if i create .gitignore that ignore itself, so it won't be pushed to git server, but will it affect my git fetch process? If there is two differenct .gitignore rules in server and in my local computer, which one will git fetch obey?

And how can i solve my problem?

Upvotes: 3

Views: 424

Answers (1)

Makoto
Makoto

Reputation: 106508

First, stop storing binaries in your repository. Git is meant to track source code changes, not changes in binaries.

Second, there are actually three locations that are read for ignoring files to be tracked: .gitignore (local project), .git/info/exclude (local project, not public), and a global excludes file, which applies to all Git projects. Anything in your personal .git folder is not shared upstream, so you can feel free to add whatever exclusions you like to that file so that they won't be propagated anywhere else.

It seems like you don't wish to create a .gitignore file since you want to avoid the risk with removing the ELF files, but you're welcome to add that exclusion to your local .git/info/exclude file.

Upvotes: 4

Related Questions