【无标题】

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
相关推荐
___波子 Pro Max.10 小时前
Git Remote 仓库地址变更
git
ModestCoder_15 小时前
Git 忽略所有 `.xlsx`,但保留指定 Excel 文件的方法
git·excel
阡陌..16 小时前
202605新版git_2.54.0常用操作指令
大数据·git·elasticsearch
会笑的小熊17 小时前
VScode项目推送到git仓库
ide·git·vscode
zhangfeng113317 小时前
宝塔服务器完全可以安装 Git,进行版本管理,而且非常简单
运维·服务器·人工智能·git·编程
Bdygsl18 小时前
Git(1)—— 基本理解与使用
git
JiaWen技术圈19 小时前
增量静态再生(ISR)详解:Next.js 中的实现与应用
javascript·git·ubuntu
The Chosen One98521 小时前
【Linux】深入理解Linux进程(二):进程的状态
linux·运维·服务器·开发语言·git
TimberWill21 小时前
git worktree实现分支管理
git
普修罗双战士1 天前
项目设计-文章系统发布文章完整前后端设计
java·数据库·vue.js·spring boot·git·intellij-idea