what is the meaning of setStartPoint in jgit when you move branch?

一曲冷凌霜 提交于 2020-01-02 14:30:50

问题


I created two branches with start point to origin/master does it have any meaning when i checkout the branches ( move between the branches ) with parameter of start Point ? What happened if I move or not moved the parameter startPoint when I checkout branches?


回答1:


You can see setStartPoint used for createBranch (also in this example)

    Ref ref = git.branchCreate().setName("testbranch").setStartPoint("origin/testbranch").call();

You can also set a startpoint on a checkout command, when you want to checkout not the HEAD of a branch, but a previous commit.
Example:

    CheckoutCommand co = git.checkout();
    File test = writeTrashFile(FILE1, "");
    File test2 = writeTrashFile(FILE2, "");
    co.setStartPoint("HEAD~2").addPath(FILE1).addPath(FILE2).call();

What happened if I move or not moved the parameter startPoint when I checkout branches

You would checkout HEAD (no startPoint specified) or you would checkout another commit from the branch checked out.



来源:https://stackoverflow.com/questions/37130665/what-is-the-meaning-of-setstartpoint-in-jgit-when-you-move-branch

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