【无标题】

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
相关推荐
正经教主6 小时前
【Git】Git05-01:Git 远程仓库协作流程原理
git·gitlab·github
QT 小鲜肉6 小时前
【Linux常用命令大全】在 Linux 系统下 Git + Vim编辑器常用指令完全指南(亲测有效)
linux·开发语言·c++·笔记·git·编辑器·vim
Protein_zmm7 小时前
Git使用
git
大筒木老辈子12 小时前
Git笔记---远程仓库的创建与基本操作
笔记·git
9***Y4813 小时前
终于解决了!Git拉取代码冲突的处理
git
南屿欣风15 小时前
Idea中Git切换分支,如何确保代码不丢失。
git
不一样的故事12615 小时前
将 Git 远程仓库的地址从 HTTP 修改为 SSH,
git·http·ssh
n***i9515 小时前
终于搞定了!Git分支回滚的正确操作
git
A***279516 小时前
终于搞定了!Git拉取代码时权限被拒绝
git
秦jh_16 小时前
【git】多人协作
git