【无标题】

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
相关推荐
YoseZang2 小时前
【手工】git的使用 – 使用git进行项目协作
git
惺忪97984 小时前
git 多个branch对多个版本进行管理
git
夜瞬7 小时前
Git工作流程与常用指令——从本地开发到远程协作
大数据·git·elasticsearch
FEF前端团队7 小时前
开发知识库 #01:Git 全面操作教程
git·github
weixin_5316518111 小时前
Git 操作指南
大数据·git·elasticsearch
一个程序猿老马13 小时前
003、Git核心概念:仓库、工作区、暂存区、版本库
大数据·git·elasticsearch
披着羊皮不是狼14 小时前
Git完整学习总结
git·学习·elasticsearch
DevilSeagull14 小时前
MySQL(1) 安装与配置
java·数据库·git·mysql·http·开源·github
一个程序猿老马14 小时前
005、Git三板斧(1):git add - 将文件纳入版本管理
大数据·git·elasticsearch
Cyber4K14 小时前
【DevOps专项】Git 部署及使用方法
运维·git·devops