Scenario: You deployed a Heroku project that contains sensitive data (password, API key, etc) but you want to share it on Github.
Problem: You need to commit all files necessary for the application to run on Heroku. However, pushing this to Github would reveal the sensitive info.
Solution: Have a production branch (for this example, master will be the production branch) and a Github branch. The latter contains a different .gitignore that ignores the sensitive files.