gpt4 book ai didi

git - 从命令行在 sublime 中打开 git diff

转载 作者:太空狗 更新时间:2023-10-29 13:24:15 25 4
gpt4 key购买 nike

如何从终端打开 sublime 中的 git diff?

最佳答案

首先,确保您可以从命令行访问 subl 命令: Open Sublime Text from Terminal in macOS

接下来,在您的 .profile 或 .bashrc 或您保留别名的任何地方,添加:

#open diff in sublime. 
#ex: gd
#ex: gd head^
#ex: gd 7b3f441147f7c3c4b27bb7c9658aef27e3d0a5eb ee49bbc57f7376bc9f5c951e13808cb6b66be3d8
gd() {
if [ $# -eq 0 ]
then
git diff | subl
else
git diff $@ | subl
fi
}

现在您可以直接从您的终端在 sublime 中打开您的差异。

关于git - 从命令行在 sublime 中打开 git diff,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28624597/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com