【无标题】

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
相关推荐
happyness449 小时前
Git:AI编程时代的“安全带“与“时光机“
git·ai编程
To_OC9 小时前
踩坑无数!终于捋顺Git基础核心工作流(新手必看)
git·程序员
xuhaoyu_cpp_java14 小时前
Git学习(三)
经验分享·笔记·git·学习
C137的本贾尼15 小时前
Git基本操作(二):add与commit,把文件交给Git管理
git
咸鱼永不翻身16 小时前
Git Hooks—提交Commit前检查本地时间是否不对
git·git-hooks·git钩子
John_ToDebug16 小时前
如何针对指定目录生成 Git Patch 并精准应用到其他分支
chrome·git
Joy T16 小时前
【Web3】Hardhat工程架构中Solidity与TypeChain的协作机制
git·架构·typescript·web3·智能合约·hardhat·typechain
步十人17 小时前
【Git】基础概念与在vscode中的简单使用
git
代码中介商17 小时前
Git 版本控制完全指南:从分支管理到远程协作
linux·git
无风听海1 天前
git fsck 深度解析 Git 仓库的体检医生
git