【无标题】

git在没有设置全局别名的话,将多个项目下设置相同的别名的脚本

bash 复制代码
#!/bin/bash

# List of aliases to add
aliases=(
    "co = checkout"
    "ci = commit"
    # Add more aliases here as needed
)

# Loop through each directory in the current directory
for dir in */; do
    # Enter the directory
    cd "$dir"

    # Check if it's a Git repository
    if [ -d ".git" ]; then
        # Enter the Git repository
        cd .git

        # Add aliases to the local config file
        for alias in "${aliases[@]}"; do
            git config --local alias."${alias%%=*}" "${alias#*=}"
        done

        # Go back to the parent directory
        cd ..
    fi
done
相关推荐
Hvitur3 小时前
Linux安装Git【离线安装】
git
howard20058 小时前
6.4 Git安装与配置
git·安装配置
tryCbest11 小时前
git实现前后端分离项目提交同一个仓库
git·gitee
Mr.朱鹏12 小时前
Git 仓库同时推送到 Gitee 与 GitHub 配置指南
git·gitee·开源·github
Flynt1 天前
HN 382分热文里的终端小技巧,我实测了一遍,git pickaxe 最值
git·命令行
横木沉2 天前
IntelliJ IDEA 无法识别 Git:Git is not installed 问题解决
java·git·github·intellij-idea
为你学会写情书2 天前
Git 学习指南:从日常命令到多人协作与提交规范
git
东小黑2 天前
Git 仓库操作与 VSCode 使用指南
git·vscode·gitee
拼图2092 天前
Git常用语法
分布式·git·学习
ShineWinsu2 天前
对于Git:基础操作的超详细保姆级解析
linux·c++·git·面试·备份·管理·版本控制器