【问题标题】:How to change git checkout to original如何将 git checkout 更改为原始
【发布时间】:2019-04-03 01:31:48
【问题描述】:

我用 git clone 克隆了一个软件。

git clone https://github.com/BinPro/CONCOCT.git

然后

cd CONCOCT
git fetch
git checkout SpeedUp_Mp

然后我收到了这条消息。

Branch 'SpeedUp_Mp' set up to track remote branch 'SpeedUp_Mp' from 'origin'.
Switched to a new branch 'SpeedUp_Mp

然后我放

sudo python ./setup.py install

现在我想像以前一样把它变成“起源”。 所以我把

git fetch
git checkout origin

然后我收到一条错误消息

error: Your local changes to the following files would be overwritten by checkout:
concoct/cluster.py
Please commit your changes or stash them before you switch branches.
Aborting

我能做什么?如何提交更改?

【问题讨论】:

    标签: git git-clone git-fetch


    【解决方案1】:

    如果要获取分支的原始版本, 结帐到新分支,在本地删除有问题的分支

    git branch -d SpeedUp_Mp
    git fetch --all
    git checkout SpeedUp_Mp
    

    否则,您可以检查您所做的所有更改

    git checkout .
    

    【讨论】:

    • 嗨@BRjava,您的回答似乎有效。我所做的是, $git checkout 。 $git fetch --all Fetching origin $git checkout origin 它现在给了我注意:签出'origin'。您处于“分离 HEAD”状态。您可以环顾四周,进行实验性更改并提交它们,并且您可以放弃在此状态下所做的任何提交,而不会通过执行另一个签出来影响任何分支。 HEAD 现在是 38d2d86... 自述文件的轻微更新
    • 看来它正在工作。我做得好吗?谢谢!
    • @SuminKi​​m 您所做的是,您在提交之前已恢复对您的分支所做的所有更改。所以分支进入原始状态。你能把这个标记为答案吗?
    • 好的!非常感谢!
    猜你喜欢
    • 1970-01-01
    • 2013-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多