1

I am using the Git Plugin of Jenkins and have a Job that needs to commit and push some changes. The git repository I am using is hosted on GitHub. Bear with me, I am somewhat new to git.

However, when I run git status or git commit it says # Not on any branch. If I tell the plugin to use a 'branch specifier', i.e. origin/master this doesn't help.

Ho do I get the plugin to behave as if I would have done git clone on my desktop?

4

1 回答 1

4

您可能已经运行了git checkout <some-sha>,所以现在git正在查看该提交,但不在任何分支的顶端。

如果您已经完成了现在所在的工作,请将其保存git diff > savefile.tmp
并签出到您想要的分支:git checkout master
然后应用您所做的工作:patch -p1 < savefile.tmp
修复任何冲突,然后git commit您的工作。
然后就可以了git push

如果您所在的位置没有完成任何工作,那么只需结帐以掌握并推送。

于 2012-04-16T11:44:19.083 回答