.gitignore by branch

Have you ever wanted to .gitignore a file by branch?

The classic example for me here is versioning the generated styles.css file on master (which is deployed to production) but not on develop (which is used for pull requests).

Versioning the styles.css file can result in merge conflicts or PRs that are just messy.

Here's the script I wrote.

Read the comments for installation notes.

Subscribe to Git