将分支完全重置为存储库状态? [英] Reset branch completely to repository state?

查看:112
本文介绍了将分支完全重置为存储库状态?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在一个共享的特性分支上,我检出了分支,并且无意中将其重新分配给master,导致了一系列问题,因为它是共享分支,我应该完成 git merge

On a shared feature branch, I've checked out the branch and inadvertently rebased it to master, causing a slew of problems as it's a shared branch and I should have done git merge.

如何将整个分支恢复为存储库中分支的状态?

How can I revert this entire branch to be exactly the state of the branch in the repository?

推荐答案

如果您只在本地完成,您可以切换到分支主机,删除您的本地功能分支并检出远程分支机构收益:

If you have done it only locally you can switch to branch master, delete your local feature branch and checkout the remote branch gain:

git checkout master
git branch -d featurebranch
git fetch
git checkout -b featurebranch origin/featurebranch

这篇关于将分支完全重置为存储库状态?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆