【无标题】

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
相关推荐
love530love1 小时前
Windows 多 Git 环境冲突:一个环境变量优先级引发的血案
人工智能·windows·git·环境变量·scoop
无限进步_3 小时前
面试题 02.04. 分割链表 - 题解与详细分析
c语言·开发语言·数据结构·git·链表·github·visual studio
甲枫叶13 小时前
【claude】Claude Code正式引入Git Worktree原生支持:Agent全面实现并行独立工作
java·人工智能·git·python·ai编程
0xwang16 小时前
Deepin25社区版修改Git编码
git
第七序章1 天前
【Linux学习笔记】git三板斧
linux·运维·服务器·笔记·git·学习
三无少女指南1 天前
开发者环境配置最佳实践:编辑器Cursor ,VS Code的上位体验实现 AI 与 WSL 联动
运维·c语言·数据库·windows·git·编辑器
Rhystt1 天前
furryCTF 题解|Web方向|保姆级详解|固若金汤、DeepSleep
git·python·安全·web安全·网络安全
头发那是一根不剩了2 天前
Git 常用命令
git
x-cmd2 天前
[x-cmd] x git - Git 命令增强工具
git·终端·命令行·x-cmd
程序员果子2 天前
Git从零到远程协作:手把手实战指南
git