【无标题】

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
相关推荐
暗暗别做白日梦3 小时前
Git 提交信息命名规范:feat、fix、refactor
git
憧憬成为java架构高手的小白5 小时前
git(基于b站狂神说学习)【未完结】
git·学习
likerhood5 小时前
Git 提交与推送常见报错处理笔记
笔记·git
chen_2275 小时前
KZPROJ Git Diff AI 审查工具
git·ai·claude·kanzi
向日的葵0066 小时前
大模型技术之git(第八章)
git
xuhaoyu_cpp_java8 小时前
Git学习(一)
经验分享·笔记·git·学习
Mr YiRan8 小时前
Android构建优化:基于Git Diff+TaskGraph
android·git·elasticsearch
Huazzi.9 小时前
Git本地和远程历史不一致问题解决步骤
大数据·git·elasticsearch
黑白园10 小时前
Windows下修改文件,使用git commit --amend推送到同一笔commit上
git
向日的葵00610 小时前
大模型技术之git(第七章)
git