【无标题】

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
相关推荐
bukeyiwanshui1 小时前
20260518 Swift实验
git·swift
qziovv1 小时前
Git 回退场景
大数据·git·elasticsearch
来自大山深处的Doge_4 小时前
解决Git提交更新更改时出错: detected dubious ownership in repository at ...
git
嵌入式爱好者hsw6 小时前
Git 部署本地仓库
git
C137的本贾尼7 小时前
Git基本操作(三):版本回退,坐上“时光机”
git
ylifs8 小时前
目的驱动式Git用法
git
来尔君9 小时前
Git Bash 提示符简化(就是每次敲命令时上面显示的那一行信息)
git·命令行
我叫张小白。9 小时前
PyCharm 集成 Git 与 Gitee
git·pycharm·gitee
小雨青年10 小时前
Git Bisect 实战:用二分法快速找到引入 Bug 的提交
git·bug
一只大袋鼠10 小时前
Git (三):Tag 标签管理、图形工具、IDEA 集成与 GitLab 私有化部署
开发语言·git·gitlab