【无标题】

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
相关推荐
wdfk_prog2 小时前
GitHub push 失败:如何扫描并清理 Git 历史中的大文件
git·elasticsearch·github
大明二代5 小时前
使用 Traefik、cert-manager 和 DNS-01 为内网 Kubernetes 服务配置 HTTPS
git·kubernetes·flux
小芒果_015 小时前
git常用命令速查
大数据·git·elasticsearch
2501_930472447 小时前
腾讯云助手规范化Git提交记录
git·elasticsearch·腾讯云
风尘小子18 小时前
git的.gitignore文件中文件和目录配置
git
Tanner_SL1 天前
Linux笔记之GIT常用命令
linux·git
醉颜凉1 天前
Jenkins与Git集成完全指南:从基础配置到自动触发构建
运维·git·jenkins
樱花落木兰1 天前
Git 超全零基础教程|三区原理、全套命令、分支协作、冲突解决、IDEA 集成(面试必备)
ide·git·json·github
云和数据.ChenGuang1 天前
git revert回退问题
java·服务器·人工智能·git·fastapi·强化学习
伞伞悦读1 天前
【第12期】Windows 开发环境备份与恢复:软件、环境变量、Git、conda 和 Docker 卷完整方案
git·docker·conda