【无标题】

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
相关推荐
一只毛驴24 分钟前
谈谈对git stash的理解?
git
长风破浪会有时呀5 小时前
Git 学习笔记
笔记·git·学习
中微子12 小时前
Git Rebase 详解:概念、原理与实战示例
git
荔枝吻16 小时前
【保姆级喂饭教程】Windows下安装Git Flow
windows·git·git flow
云和数据.ChenGuang20 小时前
git中的指令解释
git
小Lu的开源日常21 小时前
在 macOS 上设置 SSH 和 Git
git·macos·ssh
eleven_h21 小时前
ERROR: Permission to Splode/pomotroid.git deni
git
WZF-Sang1 天前
计算机网络基础——1
网络·c++·git·学习·计算机网络·智能路由器
石头wang1 天前
如何在idea里快速地切换Windows CMD、git bash、powershell
windows·git·bash·intellij-idea
SkyrimCitadelValinor1 天前
Git【开源分布式版本控制工具】安装-配置-常用指令-Git远程仓库-IDEA使用Git
分布式·git·gitee·开源·项目管理