Using JGit : How to push a specific commit to a remote repo
I need some JGit specific help please.
I am looking to the equivalent of the following using JGit library:
git push [remotename] [commit SHA]:[remotebranchname]
In other words: from a particular repo, I'd like to push everything upto a specific commit to another remote repo.
The org.eclipse.jgit.api.PushCommand
seems to be allowing me to specify only the remote name, but not the commit id or the remote branch name.
Could someone please point out what I am missing?
It got solved!!
Debugged inside JGit's transport / connection classes, looked at the advertised refs of the remote repo and found that as I was pushing my commits, the ref refs/remotes/__my_remote__repo__/master
was moving but the ref :refs/heads/master
was always staying unchanged. That was the reason, I wasn't seeing my changes reaching the GitHub.
I then switched from the earlier : commitId + ":refs/remotes/__my_remote__repo__/master"
ref-spec to commitId + ":refs/heads/master"
and it all works fine now!
The content now shows up correctly on https://github.com/my_remote__repo/commits/master.
Yay! Thanks for your help.
链接地址: http://www.djcxy.com/p/49814.html上一篇: 如何合并以前的提交