Reputation: 4782
I've a folder /build
that is regenerated at each build process. This folder needs to be versioned and the content must be excluded, so in the .gitignore
I've added build/*
and a /build/.gitkeep
to be able to add the folder.
When the content is generated it deletes the .gitkeep
file that was previously tracked by git. I would like to know if there is any way to ignore the deletion of this file. I'm looking for a solution that can works across repos, since git update-index --assume-unchanged <file>
only seems to work locally and would need to be executed on each clone.
Upvotes: 1
Views: 99
Reputation: 1489
This sounds more like something you could achieve with your build tool.
What are you using to build? could you look into making a script that writes the .gitkeep
file to the build/
folder after a build operation has been executed?
The script would be very simple, along the lines of (in a unix system):
#!/bin/sh
touch build/.gitkeep
Upvotes: 0
Reputation: 13327
The assume-unchanged command can be run automatically on each client if you add it in a post-checkout hook in the repo.
Upvotes: 1