【无标题】

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
相关推荐
Zucker n14 小时前
配置 GitHub SSH 密钥认证(自用笔记)
git
GoodStudyAndDayDayUp21 小时前
GXW-Git规范
git
weixin_307779132 天前
Git中获取一个目录下所有文件的最后修改人的邮箱
开发语言·git·算法
ynchyong2 天前
Git 急救指南:手滑 add / commit 错了,怎么优雅地撤回
git·手滑
Zucker n3 天前
Git 常用命令速查(自用笔记)
git
雪碧聊技术3 天前
Git实战:在Idea中,如何只将分支 A 某次 Commit记录的单个文件同步到分支 B?一文详解|保姆教程
git·文件对比,一键应用
Mortalbreeze3 天前
Git 基础篇(三):分支管理
git
Zucker n3 天前
安装 Git for Windows(自用笔记)
笔记·git
棒子胡豆3 天前
Git总结
git
`流年づ5 天前
联邦学习-安全聚合
git·安全·github