如何从不需要的元/配置合并中恢复?

问题描述 投票:0回答:3

我一直在本地修改 gerrit 访问文件,而不是在 UI 中执行此操作 - 当您进行批量操作时更容易。

要访问这些文件,我需要“git pull origin refs/meta/config” - 这就是它们在项目中显示的方式。

现在我希望它们消失,我不想再在项目中看到它们 - 如何使属于该引用的文件消失?如何取消获取该引用?

git gerrit
3个回答
4
投票

使用

git-pull
您已将引用
refs/meta/config
合并到当前分支(可能是
master
)。您在哪里见过该命令行?如果您想修改
meta/config
参考中的文件,您应该使用类似于 此处推荐的命令行:

git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
//edit... and then push:
git push origin meta/config:meta/config

现在的问题是你确实使用了

git-pull
。使用
git log --merges --first-parent
,尝试找到合并该分支的修订版本。然后 git
git revert <commit-id>
撤消合并。


2
投票

假设 ref 也在本地被称为

refs/meta/config
,并且文件从未提交到像
master
这样的另一个分支:

git checkout master
git update-ref -d refs/meta/config

如果这不起作用,请使用

查看引用是否以不同的名称(可能类似于
refs/remotes/origin/meta/config

)本地存储
git branch -a

您需要将

refs/
添加到
branch
显示的输出中。


0
投票

对于已接受的答案:

//edit... and then push:
git push origin meta/config:refs/meta/config
© www.soinside.com 2019 - 2024. All rights reserved.