【无标题】

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
相关推荐
猫咪老师QAQ1 小时前
基于 Git Flow 的团队协作与发布流程实践
git
caicai_xiaobai1 小时前
分享一个访问Git Hub的好方法
git
Joy T2 小时前
【Web3】跨链资金池与消息路由:CCIP 智能合约集成实战与权限收束
git·web3·node·智能合约·hardhat
難釋懷3 小时前
Nginx虚拟主机
git·nginx·github
moMo4 小时前
# Git 入门—代码仓库的使用
git·github
一路向北he4 小时前
git仓库创建新分支,上传文件
git
半个落月7 小时前
从零开始理解 Git 核心操作:告别单机开发的“原始时代”
git
东风破_7 小时前
别学 Git 命令了,先搞懂这仨区域:工作区→暂存区→仓库
git
戴国进7 小时前
详解Git的worktree实现多分支并行开发
大数据·git
凌冰_7 小时前
Claude Code was unable to find CLAUDE_CODE_GIT_BASH_PATH path路径异常解决
git