如何将git checkout更改为原始

时间:2018-10-30 03:33:12

标签: git git-clone git-fetch

我用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

我该怎么办?如何提交更改?

1 个答案:

答案 0 :(得分:1)

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

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

否则,您可以签出所做的所有更改

git checkout .