简体   繁体   English

git rev-list从分支匹配模式中排除

[英]git rev-list exclude from branches matching pattern

I want to write a query to git rev-log to do something like 我想写一个查询到git rev-log做类似

git rev-list HEAD ^origin/a ^origin/b ...

where I exclude all the commits reachable from branches on origin. 在这里,我排除了源分支上所有可到达的提交。

I see that there is the --branches=origin/* flag I can pass, but I don't seem to be able to combine it with the ^ option to exclude them. 我看到可以通过--branches=origin/*标志,但是我似乎无法将其与^选项结合使用以排除它们。

The ultimate goal is the find the closest commit to HEAD that exists on a remote branch. 最终目标是找到与远程分支上存在的HEAD最接近的提交。 I was looking at git merge-base , but that doesn't quite work here I think. 我当时在看git merge-base ,但是我认为这在这里不起作用。

嗯,正确的方法是使用--not而不是^。

git rev-list HEAD --not --branch=origin/*

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

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