need more understanding on gitblit groovy push script

那年仲夏 提交于 2019-12-25 02:48:10

问题


I have below groovy script

PushCommand push=git.push();
push.setRemote("my remote");
push.setPushAll(); //Push all branches under refs/heads/*.
push.setForce(true); //Sets the force preference for push operation.
push.call();

My requirement: want to push only changes from one gitinstance to other

setPushAll : Is this going to push all repository data all time script executed or just commied changes(I want change only)?

push.setForce(true) : What is use of this ? Should I use it in my case ?


回答1:


Got answer what I want to know As in comment

Git only pushes what is not in the target

setForce(true) will override references in the target repo with the references in the source repo. For your situation this is probably what you want. – James Moger

setPushAll will push all branches from the source to the target. This is also probably what you want. – James Moger

you can lookup in the man-page (or docs) of git-push - cfrick



来源:https://stackoverflow.com/questions/30588126/need-more-understanding-on-gitblit-groovy-push-script

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