查看最近的N到M的Git犯方面Vimdiff [英] View last N to M Git commits in vimdiff
本文介绍了查看最近的N到M的Git犯方面Vimdiff的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
下面是一个班轮,说明我想要做的:
Here is a one-liner that illustrates what I'd like to do:
revs=(2 3); f=index.html; vimdiff -d <(git show HEAD~2:"$f") <(git show HEAD~3:"$f")
我如何使用数组转速,避免硬编码?
How can I use the array revs and avoid hard-coding?
推荐答案
您可以访问 $ bash的数组元素{array_variable [指数]}
。在bash数组的下标从0开始。
You can access bash array elements with ${array_variable[index]}
. Array indices in bash start at 0.
所以
revs=(2 3); f=index.html; vimdiff <(git show HEAD~${revs[0]}:"$f") <(git show HEAD~${revs[1]}:"$f")
这篇关于查看最近的N到M的Git犯方面Vimdiff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文