【无标题】

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
相关推荐
leoZ23119 小时前
Git 集成实战完全指南(三):自动化 Commit 与 PR
大数据·git·elasticsearch
天空'之城1 天前
VS Code Git 工作树:告别频繁切分支,实现多分支并行开发实战方案
git·vscode·版本控制·嵌入式开发·开发效率·worktree·多分支管理
程序员爱德华1 天前
VSCode git/gerrit解冲突
git·vscode·gerrit
leoZ2311 天前
Git 集成实战完全指南(二):智能分支管理
大数据·git·elasticsearch
qq_452396232 天前
第六篇:《GitLab CI 进阶:多环境部署与环境变量管理》
git·ci/cd·gitlab
有想法的py工程师2 天前
GPG 密钥迁移指南:多私钥备份、批量导入与自动信任
git·github
浮江雾2 天前
Flutter第五节------Flutter开发环境配置与项目创建指南
开发语言·前端·git·学习·flutter·入门·函数
aramae2 天前
C++11:现代C++的里程碑
c语言·开发语言·c++·windows·git·后端
BerryS3N2 天前
VS Code Git 工作树:解锁多分支并行开发新体验
大数据·git·elasticsearch
工具派2 天前
从 git commit 到交付 PDF:我的一条在线工具流实录
git·elasticsearch·pdf