简体   繁体   English

删除名为 origin/xyz 的本地分支而不删除 Git 中同名 xyz 的远程分支?

[英]Deleting local branch named origin/xyz without deleting remote branch with same name xyz in Git?

I have 2 local branches named origin/QAD-1649 and QAD-1649 , and a remote branch with same name QAD-1649 .我有 2 个名为origin/QAD-1649QAD-1649本地分支,以及一个同名的远程分支QAD-1649 I want to delete the local branch named origin/QAD-1649 without deleting the remote branch so that I can continue working on the local branch QAD-1649 which should track remote branch origin/QAD-1649 .我想删除名为origin/QAD-1649本地分支而不删除远程分支,以便我可以继续在本地分支QAD-1649上工作,该分支应该跟踪远程分支origin/QAD-1649

The local branch QAD-1649 currently tracks some another branch origin/compare which is in forked main project repository.本地分支QAD-1649当前跟踪位于分叉主项目存储库中的另一个分支origin/compare I am trying to update it to origin/QAD-1649 in my main project repository.我正在尝试在我的项目存储库中将其更新为origin/QAD-1649 How can I achieve this without losing my remote branch QAD-1649 ?如何在不丢失远程分支QAD-1649情况下实现这一目标?

git branch -d only deletes local branches. git branch -d只删除本地分支。 So git branch -d origin/QAD-1649 .所以git branch -d origin/QAD-1649

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM