問題タブ [git-rev-list]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票する
1 に答える
146 参照

git-log - Dulwichチートシート: 「git log」を再現するには?

コミュニティメンバーの皆様へ

私はコード分析システムに取り組んでおり、CLI Git アプリケーションへの呼び出しを Dulwich モジュールに置き換えたいと考えています。2 番目のステップとして、「git log」コマンドを Dulwich の同等のものに置き換える必要があります。

具体的には、次のコマンドを再現しようとしています。

これは次のようになります。

私の最終的な目標は、特定のファイルに関連するブロブ (たとえば、SHA で表される) のリストを取得することです。

それを達成するための最良の方法は何ですか?

0 投票する
1 に答える
503 参照

git - Git rev-list: exclude commits already included in a merge

I have a repository with a master branch that has frequent merges from different defect branches, like in the picture below (defect1 is the name of the defect branch):

I would like to retrieve a list of all the commits of the master branch, from the one previous to commit A up until the head (in this case, E). This list will be used to revert all the commits due to a specific use case of my project.

I've been gathering this list by using git rev-list:

git rev-list "${commitA}~1"..origin/master

The problem is that when I do that, I get commits X and Y in the mix, while commit D already includes the changes of both commits X and Y. I can revert commit D with git revert -m 1. When I try to revert X and Y I get an error, since the commits are not in the master tree. I would like to retrieve A~1, A, B, C, D and E only. I could easily do something like:

git rev-list "${commitA}~1"..origin/master ^defect1

but there can be multiple defect branches with different names and it's impossible to know their names in advance.

Are there other options within git-rev-list that can enable this behavior?