need more understanding on gitblit groovy push scr

2019-09-03 16:55发布

问题:

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