so, I can easily get the diff between two commits by using
git diff hash_old hash_new file
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?
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. 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
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.