我一直在本地修改gerrit访问文件,而不是在UI中这样做-当你有批量操作时更容易。要访问这些文件,我需要“git pull origin refs/Meta/config”-这是它们在项目中的显示方式。现在我希望它们消失,我不希望在项目中再看到它们-我如何才能使属于该引用的文件消失?如何取消获取该引用?
unftdfkk1#
使用git-pull,您已经将引用refs/meta/config合并到当前分支(可能是master)。你在哪里见过这个命令行?如果要修改meta/config引用中的文件,应使用类似于those recommended here的命令行:
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>撤销合并。
git log --merges --first-parent
git revert <commit-id>
l5tcr1uw2#
假设ref在本地也被称为refs/meta/config,并且文件从未提交到另一个分支,如master:
git checkout master git update-ref -d refs/meta/config
如果这不起作用,请查看引用是否以不同的名称(可能类似于refs/remotes/origin/meta/config)存储在本地
refs/remotes/origin/meta/config
git branch -a
您需要在branch显示的输出之前添加refs/。
branch
refs/
qzwqbdag3#
一个小的变化接受的答案:
//edit... and then push: git push origin meta/config:refs/meta/config
3条答案
按热度按时间unftdfkk1#
使用
git-pull
,您已经将引用refs/meta/config
合并到当前分支(可能是master
)。你在哪里见过这个命令行?如果要修改meta/config
引用中的文件,应使用类似于those recommended here的命令行:现在的问题是,您确实使用了
git-pull
。使用git log --merges --first-parent
,尝试查找合并该分支的修订版本。然后用gitgit revert <commit-id>
撤销合并。l5tcr1uw2#
假设ref在本地也被称为
refs/meta/config
,并且文件从未提交到另一个分支,如master
:如果这不起作用,请查看引用是否以不同的名称(可能类似于
refs/remotes/origin/meta/config
)存储在本地您需要在
branch
显示的输出之前添加refs/
。qzwqbdag3#
一个小的变化接受的答案: