在VSCode中设置bash命令行内容简写

在VSCode中设置bash命令行内容简写

比如,在VSCode的bash中输入 gc daily,而实际执行 git checkout daily.

1、打开shell配置文件

在VSCode终端中输入:
code "D:\Program Files\Git\etc\bash.bashrc"

这里根据自己环境信息修改文件路径。

2、在配置文件的末尾,添加以下行来创建别名
bash 复制代码
alias gc='git checkout'

可以添加多行:

bash 复制代码
alias gc='git checkout'
alias gp='git pull'
alias gpo='git push origin'
alias gsh='git stash'
3、重新加载配置文件以使更改生效

在VSCode终端中输入:
source "D:\Program Files\Git\etc\bash.bashrc"

4、在命令行使用缩写执行命令

比如
gc daily == git checkout daily
gc release == git checkout release
gp == git pull
gpo release == git push origin release
gsh == git stash
gsh pop == git stash pop

相关推荐
超级大福宝14 小时前
VS Code Remote-SSH 因 RemoteForward 端口冲突导致连接失败的排查与解决
运维·服务器·windows·vscode·ssh
龙腾-虎跃17 小时前
Linux 趣味实战|纯 Bash Shell 脚本实现俄罗斯方块终端小游戏(完整源码资源)
linux·运维·bash
golang学习记2 天前
VSCode AI完成任务的仪式感:撒礼花
ide·vscode·编辑器
君无忧≈2 天前
【无标题】
bash
菜_小_白2 天前
codex
linux·vscode·ai
cuijiecheng20183 天前
Codex VS Code 插件新版卡住、界面异常:通过降级插件版本解决
vscode
golang学习记3 天前
VSCode AI新特性:HydraFusion来了:系统会自己组队干活
ide·人工智能·vscode
mklpo1474 天前
在win7 sp1 系统上安装最新版 的 Visual Studio Code。2026-10-04
ide·vscode·编辑器
承渊政道7 天前
Linux系统学习【线程概念与控制核心知识详解】
linux·运维·vscode·学习·ubuntu·线程创建 终止 等待
风华同学8 天前
vscode远程连接
ide·vscode·编辑器