【无标题】

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
相关推荐
一允9 小时前
Git学习记录
git·学习
程序员果子10 小时前
GraphRAG:让大模型在知识图谱中精准导航
人工智能·git·语言模型·aigc·知识图谱
later_rql13 小时前
【Git提交remote rejected】
git
Tatalaluola16 小时前
Git版本控制常用命令
git
我有酒两杯16 小时前
记录一次git使用
git
caz2817 小时前
git bash突然ssh不能用了
git·ssh·bash
Remember_99317 小时前
【JavaSE】一站式掌握Java面向对象编程:从类与对象到继承、多态、抽象与接口
java·开发语言·数据结构·ide·git·leetcode·eclipse
移远通信17 小时前
短信的应用
java·git·python
论迹18 小时前
【Git】-- 分支管理
git·ubuntu·版本控制
在下小孙18 小时前
Git与SVN常用指令
git·svn