Soft reset git bare branches

感情迁移 提交于 2019-12-23 01:52:46

问题


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?


回答1:


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!



来源:https://stackoverflow.com/questions/6689782/soft-reset-git-bare-branches

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!