【无标题】

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
相关推荐
nightunderblackcat13 小时前
新手向:Git下载全攻略
git
若无_17 小时前
了解 .husky:前端项目中的 Git Hooks 工具
前端·git
想当花匠的小码农18 小时前
Git 仓库“减肥”指南:从检测、清理到同步的全流程实践
git
R_.L1 天前
Git : 基本操作
git
python_1362 天前
git常见冲突场景及解决办法
git
洛小豆2 天前
Git 打标签完全指南:从本地创建到远端推送
前端·git·github
王道长服务器 | 亚马逊云2 天前
一个迁移案例:从传统 IDC 到 AWS 的真实对比
java·spring boot·git·云计算·github·dubbo·aws
嘟嘟可在哪里。2 天前
IntelliJ IDEA git凭据帮助程序
java·git·intellij-idea
xiaok2 天前
分支管理提交代码
git·gitlab·github