软重置git光秃秃的树枝 [英] Soft reset git bare branches

查看:93
本文介绍了软重置git光秃秃的树枝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一组GIT仓库,我在不同分支上总是有不同的活动,他们都被推送到github上



这些活动与Redmine相关联,并触发Redmine在发生推送时接收提交。由于Redmine没有安装在云端,因此我无法使用花哨的自动化github钩子来提交提交,所以我设置了Redmine钩子,以便每次执行一次提取和软重置为裸存储库时门票是更新。



那么我的问题是处理时间,因为这是我每次都做的:

 #更新主分支
git symbolic-ref HEAD refs / heads / master
git fetch origin master
git reset --soft FETCH_HEAD
#更新其他分支
git symbolic-ref HEAD refs / heads / bug_branch_n
git fetch origin bug_branch_n
git reset --soft FETCH_HEAD

有了这个,我正在做我想做的事情,但是获取过程确实需要一些时间来执行。我该如何才能在本练习中仅执行一次取指操作,并将软重置到需要更新的分支?解析方案

感谢 koppen on Github ,他们分享了Redmine Github hook的代码。解决方法是这样做: git fetch origin + refs / heads / *:refs / heads / * 一个命令来获取并更新所有分支!


I have a set of GIT repositories that I always have different activities on differrent branches and they are all pushed to github

the activities are linked to Redmine and would trigger Redmine to pick up the commits once a push happens. Since the Redmine is not setup to be on the cloud and therefore I can't use the fancy automated github hook to pick up the commits, I have setup the Redmine hook to do a fetch and soft reset to is bare repository when every time a ticket is update.

The problem i have then is the processing time because this is what I do each time:

# to update master branch
git symbolic-ref HEAD refs/heads/master
git fetch origin master
git reset --soft FETCH_HEAD
# to update the other branch
git symbolic-ref HEAD refs/heads/bug_branch_n
git fetch origin bug_branch_n
git reset --soft FETCH_HEAD

With this, I am doing what I want, but the fetch is really taking a bit of time to perform. How can I acutally fetch only once for this exercise and soft reset to the branch that needs updates?

解决方案

Thanks for koppen on Github who share the code for Redmine Github hook. The solution is to do this: git fetch origin +refs/heads/*:refs/heads/* one command to fetch and update all the branches!

这篇关于软重置git光秃秃的树枝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆