【无标题】

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
相关推荐
敲代码的嘎仔13 小时前
实习日志day6--实习日志day6--title命名规范化&businessType纠正&补充缺失的@Log注解&报警与通信模块补充&产出阶段总结文档
java·开发语言·人工智能·git·python·实习·大二
刘马想放假14 小时前
Git 从入门到进阶:一篇吃透版本管理的实战指南
git·gitlab
开发者联盟league15 小时前
git commit报错No .pre-commit-config.yaml file was found
git
猫老板的豆20 小时前
git实战
git
风曦Kisaki21 小时前
# Linux实战笔记-HIS项目实战Day01:版本控制与Git基础
linux·笔记·git
鲸~屿1 天前
Git上传本地文件到GitHub教学指南
git·github
减瓦2 天前
Windows 环境使用 Git Bash 最佳实践
windows·git
史呆芬2 天前
CodeX多仓库提交Skill搭建
git·后端·openai
城东2 天前
Git使用[原意要新建分支提交但是误提交到原来分支恢复办法]
git·原意要新建分支提交·但是误提交到原来分支