【无标题】

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
相关推荐
小哈龙4 小时前
git仓库本地化
git
naruto2274 小时前
Git推送时间修改
git
解道Jdon6 小时前
VSCode 2026年2月更新:技能市场、CLI、钩子支持
ide·windows·git·svn·eclipse·github·visual studio
悲伤小伞6 小时前
Git_原理及使用_修改文件_版本回退
linux·服务器·git
林鸿群6 小时前
Git 实战:如何将本地 .NET 项目推送到 GitLab 私有仓库
git·gitlab·.net
刘一说6 小时前
Git 工具知识全景图:从核心概念到高效协作实践
大数据·git·elasticsearch
长沙红胖子Qt6 小时前
关于 提取git所有提交日志导出到txt文本的 解决方法
git·日志导出
刚入坑的新人编程7 小时前
Linux-git的使用
linux·服务器·git
jfqqqqq7 小时前
换新电脑后拷贝的git仓库因为所属用户不同导致不能操作
git·所属用户
Xueqian E7 小时前
gitlab或其他git工具,配地址时候用内网地址
git·gitlab