在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

相关推荐
dingdingfish16 小时前
Bash学习 - 第6章:Bash Features,第11节:Bash and POSIX
bash·posix
dingdingfish19 小时前
Bash学习 - 第6章:Bash Features,第12节:Shell Compatibility Mode
bash·shell·compat·compatibility
charlie11451419121 小时前
从0开始榨干 Claude Code:VSCode 实战配置与默认读取文件完整踩坑记录
ide·vscode·编辑器
dingdingfish1 天前
Bash学习 - 第6章:Bash Features,第9节:Controlling the Prompt
prompt·bash·ps1
secondyoung2 天前
Git使用:Git使用问题及解决方法总结
windows·经验分享·git·vscode·gitee·github·gitcode
dingdingfish2 天前
Bash学习 - 第6章:Bash Features,第10节:The Restricted Shell
bash·shell·rbash·restrict
数形长夏2 天前
命令行界面的神秘符号,是上一代程序复用的尝试
架构·bash·batch
dingdingfish3 天前
Bash学习 - 第6章:Bash Features,第7节:Arrays
bash·shell·array·index·associate
念越3 天前
VS2022安装与第一个C程序编写教程
c++·vscode
加成BUFF3 天前
基于DeepSeek+Python开发软件并打包为exe(VSCode+Anaconda Prompt实操)
vscode·python·prompt·conda·anaconda