我要动态创建本地分支(比如 Hotfix_Test1,Hotfix_Test2各自在不同的时间)并将其推送到远程。
这些分支应该包含名为Release的分支中可用的源,这是另一个本地
已使用git命令将释放推送到本地远程
git push --set-upstream origin Release
我创建了一个git对象,并尝试使用以下代码动态创建修补程序分支
CREATE TABLE table_name AS
SELECT
x.id as x_id,
y.fid as y_fid,
z.fid as z_fid,
...
...
...
FROM
table_x x
LEFT JOIN
table_y y
on x.id=y.fid
LEFT JOIN
table_z z
on x.id=z.fid
...
...
...
当执行到此行时
'createBranchCommand.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);'
它正在抛出异常
我不知道这个错误。请帮助解决错误。
答案 0 :(得分:0)
您已经调用了createdBranchCommand:
/* Creating Hotfix Branch */
createBranchCommand = git.branchCreate();
createBranchCommand.setName("hotfix_" + releaseVersion).call();
然后在尝试再次使用该branchCreate()命令之前进行了推送:
/* Trying to set upstream for newly created hotfix branch */
createBranchCommand.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
createBranchCommand.setStartPoint("origin/" + "hotfix_" + releaseVersion);
createBranchCommand.setForce(true);
createBranchCommand.call();
尝试创建分支并一次设置其上游配置,然后在以下之后推送:
/* Creating Hotfix Branch */
createBranchCommand = git.branchCreate();
createBranchCommand.setName("hotfix_" + releaseVersion);
createBranchCommand.setUpstreamMode(SetupUpstreamMode.SET_UPSTREAM);
createBranchCommand.setStartPoint("origin/" + "hotfix_" + releaseVersion);
createBranchCommand.setForce(true);
createBranchCommand.call();