【无标题】

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
相关推荐
ityangs9 小时前
GitLab 私服(基于 Docker)搭建方案
git·docker·容器·gitlab
ZYMFZ12 小时前
Redis主从复制与哨兵集群
前端·git·github
三体世界18 小时前
Qt从入门到放弃学习之路(1)
开发语言·c++·git·qt·学习·前端框架·编辑器
汤面不加鱼丸19 小时前
git常用指令
git
秦jh_1 天前
【git】基本操作
git
徐同保1 天前
Arguments: ls-remote --tags --heads git://github.com/adobe-webplatform/eve.git
git·adobe·github
北塔软件1 天前
各品牌服务器IPMI配置实战经验分享
服务器·git·github
一只小bit2 天前
Git 远程操作:克隆、推送、拉取与冲突解决
数据库·git·github
__Witheart__2 天前
.gitignore 不生效问题——删除错误追踪的文件
git
月临水2 天前
Git 学习笔记
笔记·git·学习·1024程序员节