Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在一个本地分支上工作,我需要从原点拉下一个分支,所以我发出了以下命令:
git pull 原点设计
当我这样做时,该分支最终被合并到我当前的本地分支中,这根本不是我想要的。所以我需要做两件事:
要退出由创建的合并提交pull:
pull
git reset --hard HEAD^
如果合并是快进合并(意味着您没有在本地完成任何工作),那么git reset --hard您要在本地保留最后一次提交的 sha1。
git reset --hard
要在不合并的情况下获取远程分支:
git fetch origin
远程分支将显示为origin/master(带有git branch -a)。
origin/master
git branch -a