【无标题】

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
相关推荐
Haooog6 小时前
OpenHands 定时任务同步后还是关着?先查 Git Sync 的启停开关
git·agent·定时任务·配置管理·openhands
崖边看雾1 天前
Git 手册:三区、分支、撤销、冲突与团队协作
大数据·git·elasticsearch
李永奉1 天前
Git和GitHub-VS Code 图形化 Git 放弃更改、暂存与取消暂存、撤销上一次提交(VS Code 界面操作 + 命令行对照)
git·github
aifannihao2 天前
断言从 == 改成 > 0:用 Python 审出 git diff 里的测试降级
git·python·测试·标准库·代码审查
李永奉2 天前
Git和GitHub-VS Code 图形化 Git初始化、状态标识、提交、关联远程仓库与首次推送(全程在 VS Code 内完成,每步附对应Git命令)
git·github
橘子☆心酸2 天前
Git 的自我修养
git·svn·gitee
李永奉3 天前
Git和GitHub-用操作命令控制Git 分支的查看、创建、切换、合并与删除管理实操教程
git·github
7177773 天前
SVN 迁移到 Git 用什么工具:git-svn、svn2git 与平台化方案的取舍
git·svn
李永奉3 天前
Git和GitHub-用操作命令控制Git的工作区、暂存区、本地仓库之间状态的提交教程
git·github
羊在吃青草4 天前
Git之远程仓库
git