【无标题】

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
相关推荐
likuolei3 小时前
Git 与 SVN 区别
git·svn
charlee448 小时前
Git使用经验总结8-Git仓库历史记录清除
git·powershell·敏感信息·仓库重置·历史重写
正经教主9 小时前
【Git】Git05-04:Github分支管理与协作流程
git·github
sean90811 小时前
git filter-repo(优秀的 git repo 历史重写工具) 实战
git·repo·工具
hen3y11 小时前
清理 Git 代码库大文件历史记录
运维·git
小Lu的开源日常12 小时前
踩坑日记:为什么Git 突然 Push 不上去了
git·ssh·github
LZ7工作室13 小时前
MAC编程:在MACOS安装和使用 Git 的方法
网络·git·macos·github·个人开发
T***160715 小时前
Git增强现实案例
git·ar
Arva .17 小时前
git常用
git
久莜17 小时前
【Git】使用教程
git