【无标题】

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
相关推荐
宋隽颢1 小时前
GIT工具学习【4】:推送到远程仓库
git·学习
杰瑞学AI1 小时前
Devops之GitOps:什么是Gitops,以及它有什么优势
运维·git·云原生·kubernetes·devops·argocd
. . . . .2 小时前
git合并分支原理
git
我是黄骨鱼9 小时前
快速idea本地和推送到远程仓库
git
王鑫的博客88618 小时前
本地git操作
c语言·git
码见愁21 小时前
Git分布式版本控制工具
分布式·git
程序猿chen1 天前
JVM考古现场(十九):量子封神·用鸿蒙编译器重铸天道法则
java·jvm·git·后端·程序人生·java-ee·restful
混血哲谈1 天前
如何安装git?
git
尸僵打怪兽1 天前
gitee基本使用
git·gitee·git使用
冰凌糕1 天前
Git 远程仓库
git·版本控制