Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

速记:git将一个分支完全覆盖另外一个分支 #27

Open
sqliang opened this issue Jun 19, 2019 · 0 comments
Open

速记:git将一个分支完全覆盖另外一个分支 #27

sqliang opened this issue Jun 19, 2019 · 0 comments

Comments

@sqliang
Copy link
Owner

sqliang commented Jun 19, 2019

场景

在开发和上线过程中,有时需要废弃某个分支,并将另一个分支的内容全部覆盖到当前分支,来进行上线或者维护等操作。

覆盖命令

比如: 当前分支为master分支,想要将远程adaptPkg分支完全覆盖到master分支

git checkout master
git reset --hard origin/adaptPkg

执行上述命令后,本地master分支的代码会完全被adaptPkg分支上的代码覆盖,接下来只需将本地master分支强行推到远程

强行推到远程

git push -f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant