一个自定义的 Git 可视化命令,输出 5 行彩色日志。
- 打开 PowerShell 配置文件:
notepad $PROFILE如果提示文件不存在,先运行:
New-Item -Path $PROFILE -Type File -Force-
将
git-vv.ps1的全部内容复制粘贴到$PROFILE文件中,保存关闭。 -
刷新生效:关掉终端重开,或执行:
. $PROFILE- 用法:在任意 Git 仓库目录下输入
gvv即可。
- 复制脚本到系统命令目录:
cp git-vv.sh /usr/local/bin/git-vv
chmod +x /usr/local/bin/git-vv- 如需简短别名
gvv,编辑~/.bashrc:
echo "alias gvv='git-vv'" >> ~/.bashrc
source ~/.bashrc- 用法:在任意 Git 仓库目录下输入
gvv或git-vv。
无需安装脚本,直接通过管道运行:
Linux/macOS:
curl -sL https://raw.githubusercontent.com/VincentZyu233/git-vv-script/main/git-vv.py | python3Windows PowerShell:
irm https://raw.githubusercontent.com/VincentZyu233/git-vv-script/main/git-vv.py | pythonLinux/macOS:
curl -sL https://gitee.com/vincent-zyu/git-vv-script/raw/master/git-vv.py | python3Windows PowerShell:
irm https://gitee.com/vincent-zyu/git-vv-script/raw/master/git-vv.py | pythonLinux 可加别名到 ~/.bashrc:
echo "alias gvvp='curl -sL https://raw.githubusercontent.com/VincentZyu233/git-vv-script/main/git-vv.py | python3'" >> ~/.bashrc
source ~/.bashrcWindows 可在 $PROFILE 中添加函数:
function gvvp { irm https://raw.githubusercontent.com/VincentZyu233/git-vv-script/main/git-vv.py | python }