【无标题】

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
相关推荐
苍煜44 分钟前
Git Worktree 多工作树实战教学-工作多分支实用教程
git
RainingTime4 小时前
新版IDEA使用传统用户名、密码登录Git
git
DevangLic14 小时前
【诡异的空文件夹 和 git:冲突合并】最新的尝试
git
舒一笑16 小时前
Windows + WSL2 完整复现 Avernet WAIC 6 Bot 协作演示
人工智能·git·开源
生戎马 平安京策1 天前
git寻根——^和~的区别
git
技术小结-李爽1 天前
【工具】git远程分支合并
git·gitee
RootKai1 天前
Git命令与基本使用流程
git
AdaTina1 天前
关于git的初始操作
git
Coder-LiyG1 天前
Git 常用操作指南:从初始化到回退的高频命令速查
git