在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

相关推荐
时光803.4 小时前
快速搭建青龙面板Docker教程
windows·ubuntu·bash·httpx
无奈笑天下9 小时前
银河麒麟V10虚拟机安装vmtools报错:/bin/bash解释器错误, 权限不够
linux·运维·服务器·开发语言·经验分享·bash
NiceAsiv13 小时前
VSCode之打开python终端 取消conda activate的powershell弹窗
vscode·python·conda
胖好白14 小时前
【RK3588开发】RK3588的Debian系统环境搭建
linux·vscode·debian
DevGu17 小时前
Linux 子账户显示bash-4.25,不显示用户名
linux·运维·bash
Hiweir ·17 小时前
ROS Noetic教程------VSCode创建ROS话题通讯--发布方的简单流程
vscode·python·ros noetic·ros noetic教程
肆悟先生18 小时前
2.1visual Studio code 插件
ide·vscode·编辑器·html5
LYOBOYI12319 小时前
使用vscode创建qt的qml项目
ide·vscode·编辑器
花哥码天下1 天前
修复Bash脚本Here Document错误
开发语言·bash
秋邱1 天前
Java面向对象进阶实战:用工厂模式+策略模式优化支付系统
java·bash·策略模式