【无标题】

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
相关推荐
春日见6 小时前
如何创建一个PR
运维·开发语言·windows·git·docker·容器
stevenzqzq1 天前
git 常用操作
大数据·git
Curvatureflight1 天前
Git工作流最佳实践:从混乱到优雅
git
wu~9701 天前
GitHub永不遗忘,使用git push -f来覆盖的提交依旧保留
git·github
Vermouth_001 天前
git clone的时候提示access denied
git
qq_437657271 天前
清楚本地的git并重新登录
git
jiang_changsheng1 天前
工作流agent汇总分析 2
java·人工智能·git·python·机器学习·github·语音识别
顶点多余1 天前
版本控制器-git
linux·git
夔曦1 天前
Git工程日常下拉/上传完整流程(自用)
git
岱宗夫up1 天前
GitHub Desktop如何设置中文?这不是个简单问题
git·github