I frequently find myself changing a single variable in my project within Git to connect to a different server while on the Development branch (in JavaScript, so I can\'t use
Sounds like you might be interested in a hook; specifically, look into the post-checkout hook. Basically, you would write a small script that modifies a file after checkout based on the value of $(git branch). You don't mention exactly what would need to happen, but it would likely involve sed.
You might add the relevant file to a .gitignore file, or maybe write a pre-commit hook, so that your change doesn't accidentally propagate to the public repo.