I would like to store all of my dotfiles on GitHub, including .gitconfig which requires me to hide the GitHub token in the .gitconfig.
To do so I have a \".gitconfig-hid
Add your .gitconfig with git add -N
.
Then git add -p
it, edit the hunk, replace the token with anything, and push that. No need for an extra file this way.
Addendum: on additional modifications of your file, use git add -p
again, and edit the hunk so that your initial manipulation not be overwritten.