[英]git diff between the latest commit and the last one I did
so, I can easily get the diff between two commits by using 因此,我可以使用轻松获得两次提交之间的差异
git diff hash_old hash_new file
git diff hash_old hash_new文件
that works, but in my current workflow my diffs are invariably between the latest commit and my commit. 可以,但是在我当前的工作流程中,我的差异总是在最近的提交和我的提交之间。 is there a way to automate that with a shell alias so that i don't have to manually copy the two hashes but instead always pick the latest with my name or email and compare it against the latest in line?
有没有一种方法可以使用shell别名自动执行该操作,这样我就不必手动复制两个哈希,而总是选择带有我的姓名或电子邮件的最新哈希值并将其与最新的行进行比较?
I tried to do this by subsetting the output of git diff through a shell function and then creating an alias, but not sure the output is stored as an array. 我试图通过使用shell函数将git diff的输出设置为子集,然后创建一个别名来做到这一点,但是不确定输出是否存储为数组。 any suggestions?
有什么建议么?
这可能是最短的解决方案,也是最稳定的解决方案,因为它使用低级helper命令进行历史记录遍历):
git diff $(git rev-list --author="Your Name" -1 HEAD) HEAD
Try this: 尝试这个:
$ git log -1 --pretty=format:"%h" --author=<name> | xargs git diff
Replace <name>
with your git user-name
. 将
<name>
替换为您的git user-name
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.