【问题标题】:How to add a orphan branch in smartgit如何在 smartgit 中添加孤立分支
【发布时间】:2013-04-03 04:00:23
【问题描述】:

我需要创建一个没有父级的孤立分支。如何在 Smartgit 中进行操作?

在这方面需要一些指导..

【问题讨论】:

    标签: git smartgit orphan


    【解决方案1】:

    这是一个例子,如果 SmartGit 不支持 GUI 中的孤立选项,您也可以使用 CLI(命令行界面)并快速键入:

    git checkout --orphan newbranch
    

    (如“In git, is there a simple way of introducing an unrelated branch to a repository?”)

    至少提交一个文件(仍然通过 GUI):

    git add afile
    git commit -m "a first commit in orphan branch"
    # no push here, this is purely a local operation in your local repo
    

    然后你回到 SmartGit,你的新(孤立)分支应该在那里。

    【讨论】:

    • 我按照你说的做了-> 但在 SmartGit 中看不到分支
    • @lakesh 我怀疑是因为您需要在那个新的孤立分支中至少进行一次提交。
    • 这个提交是通过 CLI 还是 Smartgit?
    • @lakesh 通过 CLI (git add afile, git commit -m "first commit"),因为该分支还不能通过 SmartGit 看到。
    • 提交只是将其推送到暂存,而不是将其推送到原点,对吗?这是因为,我担心它可能会影响存储库中的文件。
    猜你喜欢
    • 2010-10-05
    • 2020-10-26
    • 1970-01-01
    • 2017-08-19
    • 2015-02-22
    • 2013-10-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多