简体   繁体   English

我忘记将修补程序分支合并到我的开发分支。 删除后可以恢复吗?

[英]I forgot to merge a hotfix branch to my develop branch. Can I recover it after it's been deleted?

I made the mistake of merging a hotfix branch with master and then deleting the branch before merging it with develop . 我做了合并与 修补程序分支,然后合并它与之前开发删除分支的错误。 Is it possible to recover the hotfix branch so I can do the missed merge? 是否可以恢复修补程序分支,以便我可以进行错过的合并? Or would something like a cherry-pick work just the same? 还是像采摘樱桃一样起作用?

Thanks. 谢谢。

The commit should still be available on the machine you deleted the branch from. 删除分支所在的计算机上的提交仍应可用。

If you can remember the commit hash, it's really easy -- just do a git checkout <commit hash> . 如果您还记得提交哈希,那真的很容易-只需执行git checkout <commit hash> Then you can point a branch at the commit. 然后,您可以将分支指向提交。

If you don't remember the commit hash, things are a bit more difficult, since you will need to find a dangling commit. 如果您不记得提交哈希,那么事情会变得有些困难,因为您将需要找到一个悬空的提交。

This blog post gives a quick overview on how to do that: http://gitready.com/advanced/2009/01/17/restoring-lost-commits.html 这篇博客文章提供了有关该操作方法的快速概述: http : //gitready.com/advanced/2009/01/17/restoring-lost-commits.html

did you delete the branch only locally ? 您是否仅在本地删除分支? ie: git branch -d <branch> or globally ie git branch -D <branhc> ? 即: git branch -d <branch>或全局即git branch -D <branhc>吗?

if the branch is still available on remote you can pull it back down, if you deleted it from both local you can go back to the commit in your master branch where you merged in the hotfix and create a new branch from that commit hash git checkout -b <commit hash> 如果分支在远程仍然可用,则可以将其拉回;如果从两个本地都删除了分支,则可以返回到主分支中的提交,在此分支中合并了此修补程序,并从该提交中创建新分支git checkout -b <commit hash>

then merge that branch into the develop branch? 然后合并该分支到开发分支?

暂无
暂无

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

相关问题 不小心提交到主分支而不是开发分支。 现在我的主分支在开发分支之前。 我该如何解决? - Accidentally commited to main branch instead of develop branch. Now my main branch is ahead of the develop branch. How can I fix it? 我的主分支在另一个分支下面。 这可能是个问题? - My main branch is below another branch. It's can be a problem? 在git分支中工作。 我可以重新设置基础以保留分支更新吗? - Working in git branch. Can I rebase to keep branch updates? 如果我忘记推送提交并从本地开发分支创建功能分支,如何解决 GIT 冲突? - How to resolve GIT conflict if I forgot to push the commits and created a feature branch from my local develop branch? 我用-d删除了一个分支,如何恢复/恢复它? - I deleted a branch with -d, how can I restore/recover it? 我忘记创建主分支时如何“合并” git分支 - How to “merge” a git branch when I forgot to create a master branch Github给了我分支上的提交次数。 我可以将其用作git rebase -i参数的一部分吗? - Github gives me the number of commits on my branch. Can I use this as part of git rebase -i arguments? Git:我忘了分支 - Git: i forgot to branch 我需要在我的主分支中弹出并删除“中间”提交。我该怎么做? - I need to pop up and trash away a “middle” commit in my master branch. How can I do it? Git:我忘记创建分支 master,如果我的存储库已经有另一个分支,我该如何创建它? - Git: i forgot create branch master, how i can create it if my repository already has another branch?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM