【无标题】

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
相关推荐
小黑要努力8 小时前
智能音箱遇到的问题(一)
linux·运维·git
RePeaT9 小时前
【git】指令场景实战:单分支与多分支协作流程
git
前端Hardy10 小时前
杀疯了!Git 2.54 正式发布,3个封神新特性,效率直接翻倍!
git
Eloudy12 小时前
迁移带有 git lfs 功能的 github 仓库
git·github
xlq2232213 小时前
1.git
git
运维全栈笔记14 小时前
零基础掌握Jenkins CI/CD:Java项目自动构建与部署全流程指南
git·servlet·ci/cd·gitee·自动化·jenkins·devops
菜萝卜子15 小时前
【Git】GitLab 18.9 全局服务器钩子(Server Hooks)官方规范与落地实践
服务器·git·gitlab
用户114818678948416 小时前
Git Stash 丢失后的完整找回指南
前端·git
Ting.~16 小时前
GIT详解
java·笔记·git
克拉拉KLARA17 小时前
vscode禁用在git提交中插入ai coauthor copilot
git·vscode·copilot