Skip to content

Instantly share code, notes, and snippets.

@wxianfeng wxianfeng/cfg
Last active Dec 14, 2015

What would you like to do?
由于git pull,push慢,一般我是多次commit,一次push. 并且在 commit 中填写 fix #xxx, 随手把pm上 issue的状态改为已解决. 不手动关的话,不够实时,没人点击版本库,测试人员看不到已解决.
手动关的话,带来一个问题,状态已解决, 测试人员就开始验证了,但是代码没push.
>vi .git/config
default = current
xpush = !git push && .git/hooks/post-push
>touch .git/hooks/post-push && chmod +x .git/hooks/post-push
还有一种更方便的办法就是利用 git hooks, 但是需要在 git server 端配置.
git xpush 替换 git push
# ref
#!/usr/bin/env ruby
require 'httparty'
require 'json'
base = ''
# get login session cookie
login_url = "#{base}/login"
headers = { 'Content-Type' => 'application/json' }
body = { username: 'wangxianfeng', password: '' }.to_json
options = { body: body, headers: headers }
login_response =,options)
login_cookie = login_response.headers['set-cookie']
# visit repo uri
repo_url = "#{base}/projects/isdev/repository"
repo_headers = { 'Cookie' => login_cookie }
HTTParty.get(repo_url,{ headers: repo_headers })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.