【无标题】

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
相关推荐
m0_488633321 小时前
Windows环境下编译运行C语言程序,合适工具与方法很关键
c语言·windows·git·开发工具·编译器
春日见2 小时前
云服务器开发与SSH
运维·服务器·人工智能·windows·git·自动驾驶·ssh
蜡台4 小时前
Vue 中多项目的组件共用方案
前端·javascript·vue.js·git
剑飞的编程思维6 小时前
技术评审方法与流程全解析-如何做好技术评审
git·架构·个人开发·学习方法·技术美术·代码复审
OPMR6 小时前
【Git基础】从入门到入门——安装和远端链接
git
liu****7 小时前
5.git标签管理
c++·git·版本控制
新晨4379 小时前
Git跨分支文件恢复:如何将其他分支的内容安全拷贝到当前分支
前端·git
kishu_iOS&AI9 小时前
Git SSH + SourceTree篇
运维·git·ssh
Java小白,一起学习9 小时前
git提交格式(Conventional Commits 规范)
git
liu****9 小时前
linux上git推送内容到gitee上
c++·git·gitee·版本控制