Is there any way to distribute smudge and clean hooks to remote repository? It's stored in .git\config so it is not tracked by Git.
Our client use slightly different environment and SVN(!) so we have to branches so we could merge our changes. It would be great if I could share those hooks for smudge and clean.
Yes, the answer are .gitattributes. A slightly more objective description how to set the filters can be found in the man-files.
Put your attributes into a .gitattributes-file and save it into your project-folder. You're then able to track and commit it like other files.
Unfortunately, changing the filter itself needs you to access the .git/config of your client at least once. In my opinion you have two options for realizing that: deliver a second project-specific config or change the filter-calls to invoke delivered scripts.
This is a simple approach to version an additional part of the git-config. We're going add a additional include-path to the repo-config and a additional config-file within the repository.
This is how i added another include to the .git/config:
[include]
../.gitconfig
Then you'd create the .gitconfig-file - i tested it with the user.name-setting:
[user]
name = Mickey Mouse
After that you'll add the .gitconfigto your repo. Try your changes with:
$ git config user.name
Mickey Mouse
But i must admit that this constellation is a security-risk since you're able to overwrite all configuration-settings with a commit.
Another possible - and safer but more elaborate - solution would be to create the filters in the config and let them point to scripts within your repository.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With