Run any program before Git | push to reduce mistakes
Solution
Register the command you want to run before push as a git alias.
[push] default = current [alias] before-push = !bundle exec rubocop && bundle exec rake notes && echo 'sleep 10 seconds and you will push' && sleep 10 gentle-push = !git before-push && git push
Then you can use $ git gentle-push
.
Above is an example of running rubocop (Ruby's grammar checker) and notes (a task that finds annotations).
result
Like this.
↓
Description
- Sleeping for 10 seconds is to allow Command + C to exit when something goes wrong. Note that it does not stop automatically.
- I want you to rewrite necessary parts timely. For example, make push be push -f.
combination
It would be nice to put an alias that rebases the current branch into the "latest master" with one command in before-push.
[push] default = current [alias] new-world = !git checkout master && git pull origin master && git checkout - && git rebase master before-push = !git new-world && bundle exec rubocop && bundle exec rake notes && echo 'sleep 5 seconds and you will push' && sleep 5
problem
Often you forget what you want to run before push. It is better to understand the mistake at hand.
environment
- git version 2.3.8 (Apple Git-58)
- Mac OSX Yosemite
Original by
Git | push の前に任意のプログラムを走らせてミスを減らす
About
Author And Source
この問題について(Run any program before Git | push to reduce mistakes), 我々は、より多くの情報をここで見つけました https://qiita.com/YumaInaura/items/94cc323a5897bdf85bb4著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .