【无标题】

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
相关推荐
Ws_7 小时前
Git + Gerrit 第二课:diff、暂存区与撤销修改
git
snowjlz8 小时前
鸿蒙版SVN来了!!!
git·svn·版本控制
2401_876964139 小时前
27考研余炳森概率论|喻老李良2027资料网课
windows·git·考研·svn·eclipse·github·概率论
爱搬砖的狮子10 小时前
【Git】git repo下载使用
git
cheems952713 小时前
Git基本操作
git
Irissgwe14 小时前
三、Git 文件状态管理:add、commit、status 和 diff
git
Ws_18 小时前
Git + Gerrit 第三课:分支、切换与合并
git·elasticsearch
xlq2232219 小时前
6.git
git
Drache_long19 小时前
Git命令概述
git
console.log('npc')19 小时前
修改git中commit内容
git