【无标题】

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
相关推荐
Mr_Dwj5 小时前
【工具】Git 子仓库管理
git
Rysxt_13 小时前
Git Rebase 变基教程:作用、使用场景与合并的区别
git·变基
刘某某.14 小时前
提交 git 的三种方式
git
bigHead-16 小时前
Git 修改远程仓库地址的几种方法
git
杀手不太冷!17 小时前
Jenkins的安装与使用;git clone url的时候,url为http和ssh时候的区别
git·http·jenkins
qq_2290580118 小时前
GIT使用方法
git
YMGogre18 小时前
Git 多人协作开发
git
凯子坚持 c1 天前
Git 多人协作深度解析:从工作流模拟到仓库维护
git
要站在顶端1 天前
克隆大型仓库卡住(7%每次就卡住了)
git
五月底_1 天前
上传大量文件到github repo
git·github