简体   繁体   English

跑了'git checkout stash',现在想用我藏匿的当前未附加分支覆盖现有分支

[英]Ran 'git checkout stash' and now want to overwrite an existing branch with my current unattached branch that i had stashed

So I messed up a bit in my branches and they weren't building, fortunately I had the project working stashed so i did a 所以我弄乱了我的分支机构,但它们没有在建,幸运的是我的项目已经停工了,所以我做了

git checkout stash

and that reverted my project to building successfully. 这使我的项目恢复为成功构建。 I now want to overwrite an existing branch called 'develop' with my current unattached branch. 现在,我想用当前的未连接分支覆盖一个名为“ develop”的现有分支。 Essentially i just want the name of the 'develop' branch but i want everything in it gone and replaced with my current stash branch. 本质上,我只想要'develop'分支的名称,但我希望其中的所有内容消失并替换为当前的stash分支。 For reference when i run 供我跑步时参考

git s

currently i get: 目前我得到:

## HEAD (no branch)
?? Project/Setup_BACKUP_38164.swift
?? Project/Setup_BASE_38164.swift
?? Project/Setup_LOCAL_38164.swift
?? Project/Setup_REMOTE_38164.swift

Many thanks! 非常感谢!

You will want to do a git show to get the SHA1 commit ID of the current HEAD. 您将需要执行git show以获得当前HEAD的SHA1提交ID。 With that information, switch to the develop branch and run the command: 有了这些信息,切换到develop分支并运行命令:

git merge abc123

Where "abc123" is the SHA1 ID. 其中“ abc123”是SHA1 ID。

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

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