我可以git隐瞒正在进行的合并吗? [英] Can I git stash a merge in progress?

查看:76
本文介绍了我可以git隐瞒正在进行的合并吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为git合并解决冲突,但是我想暂时恢复到干净状态而不丢失在合并中已经完成的工作.如果我尝试git stash,则对于尚未解决冲突的每个文件都会出现错误:需要合并".

I'm in the middle of resolving conflicts for a git merge, but I want to get back to a clean state temporarily without losing the work I've already done on the merge. If I try to git stash, I get errors for each file for which a conflict has not yet been resolved: "needs merge".

是否存在保存进行中合并的好方法?我唯一的想法是将存储库克隆到另一个文件夹中,但这似乎太过分了.

Is there a good way to save the merge-in-progress? The only idea that I have is to clone the repo into a different folder, but that seems excessive.

推荐答案

您可以使用 git worktree 命令在其他文件夹中添加新的工作树.这就像第二个索引和工作树,但是使用相同的git repo. man git-worktree :

You could use the git worktree command to add a new worktree in a different folder. This is like a 2nd index and worktree, but using the same git repo. man git-worktree:

   Manage multiple working trees attached to the same repository.

   A git repository can support multiple working trees, allowing you to check out
   more than one branch at a time. With git worktree add a new working tree is
   associated with the repository. This new working tree is called a "linked working
   tree" as opposed to the "main working tree" prepared by "git init" or "git clone".
   A repository has one main working tree (if it’s not a bare repository) and zero or
   more linked working trees.

这篇关于我可以git隐瞒正在进行的合并吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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