【无标题】

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
相关推荐
5***a9759 小时前
Git虚拟现实案例
git·vr
牛奔10 小时前
git 清理未跟踪文件
git
摇滚侠12 小时前
VsCode 自带的 Git 使用教程
ide·git·vscode
H***997613 小时前
Git物联网案例
git·物联网
g***B73813 小时前
Git版本控制工具对比
git
weixin_4569042714 小时前
Git大文件管理与版本回退
大数据·git·elasticsearch
J***Q29218 小时前
Git虚拟现实开发
git·vr
油丶酸萝卜别吃19 小时前
GitHub 上查找中国乡镇经纬度范围数据的开源项目
git·github
9***P3341 天前
Git测试框架使用指南
git
X***48961 天前
Git数据分析应用
git