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).

결과



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.

    환경


  • git version 2.3.8 (Apple Git-58)
  • Mac OSX Yosemite

  • Original by



    Git | push 전에 임의의 프로그램을 실행하여 실수를 줄입니다.

    About



    About this translation

    좋은 웹페이지 즐겨찾기