【无标题】

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
相关推荐
悦悦欧呐呐呐呐8 分钟前
git 设置邮箱和用户名
git
正经教主19 分钟前
【Git】Git06:Git 管理 Android 项目教程(含GitHub)
android·git
艾莉丝努力练剑4 小时前
【Git:多人协作】Git多人协作实战:从同分支到多分支工作流
服务器·c++·人工智能·git·gitee·centos·项目管理
liuyao_xianhui16 小时前
版本控制器git--gdb/cgdb
linux·运维·服务器·git
徐同保17 小时前
如何使用GitKraken把git项目迁移到另一个平台,并保存所有提交记录,例如把github上的项目,迁移到gitee
git·gitee·github
高小秋17 小时前
项目开发使用 git工作流插件 -- jgitflow开发实践
git
tealcwu17 小时前
【软件工程】浅析Git message, version, changelog之间的关系
git
五号厂房19 小时前
Git Worktree 使用指南
git
秦jh_20 小时前
【git】企业级开发模型
git
y***548821 小时前
Git在开源项目中的协作
git