Title: Is it possible to create a warning when pushing to a specific (i.e. live) git source?
Tags: git;heroku;git-push
Question: I run two Heroku servers, one dev and one production.  I set up Git with targets so I can do
git push dev ...
git push production ...
I push unfinished features that I'm testing all the time to the dev with
git push dev newBranch:master
I know that one of these days, when I'm tired, or overworked or just absent-minded, I'm going to mistakenly type
git push production newBranch:master
and push an untested, unworking feature to our live server and not realize it. Is there some way to build in a warning, so that, when I run
git push production
Warning, you are about to push to the live server, do you want to
continue (y/n)
or some other indication shows up on the screen?  I would sleep easier at night knowing a guard like that exists.
Comment: [Kevin](http://stackoverflow.com/a/27066860/2541573) is right: you should use the `pre-push` hook for this. Alternatively, here is a dirty hack: http://stackoverflow.com/questions/25884007/disable-git-add-command/25886149#25886149


Here is another answer: You could use git's pre-push hook.
You can learn more about hooks here, and you likely have example scripts installed with your git distribution (or even in your repo!)

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 1, 'CommentCount': 1, 'ContentLicense': 'CC BY-SA 3.0', 'CreationDate': '2014:00:11/21/14', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<git><heroku><git-push>', 'Title': 'Is it possible to create a warning when pushing to a specific (i.e. live) git source?', 'ViewCount': 32, 'id': 27065681, 'user_AboutMe': "<p>I'm a computer scientist and extreme programmer.  I like long walks on the beach...while talking about variable scope.</p>\n", 'user_AccountId': 1198610.0, 'user_DisplayName': 'J-bob', 'user_Reputation': 7716.0, 'user_Views': 223.0, 'user_id': 1169781.0}}