【无标题】

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 小时前
Learn Git Branching:提交的技巧
git
say_fall1 小时前
Git完全入门指南-从概念到实战掌握版本控制的核心
linux·运维·服务器·git·学习
小陶来咯1 小时前
Git Cherry-Pick
git
淘矿人1 小时前
Claude助力前端开发
java·数据库·git·python·sql·spring·database
sunarmy2 小时前
在git for windows下安装pacman
git
哎呦,帅小伙哦2 小时前
Git Describe 与 TRAVIS_TAG学习笔记
笔记·git·学习
谷哥的小弟2 小时前
(最新版)Git&GitHub实操图文详解教程(04)—远程仓库GitHub
git·github·pull·push·版本管理·版本控制
weelinking7 小时前
【2026】08_Claude与版本控制:Git协作技巧
数据库·人工智能·git·python·数据挖掘·交互·cloudera
码力斜杠哥11 小时前
Git的说明及基本使用
git
摆烂且佛系12 小时前
git reset 与 git revert 区别
git