【无标题】

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
相关推荐
我是若尘24 分钟前
Git Rebase深度解析:优雅重写提交历史的艺术
git
我是若尘1 小时前
Git合并踩坑记:当master回退后,如何正确合并分支?
git·代码规范
摇滚侠1 小时前
零基础小白自学 Git_Github 教程,Action CI/CD 完整实践,笔记23
笔记·git·ci/cd
minji...3 小时前
linux 进程控制(一) (fork进程创建,exit进程终止)
linux·运维·服务器·c++·git·算法
系夏普3 小时前
Git 入门教程:初始化、修改与提交
git
laplaya3 小时前
Git 使用技巧
git
奶油松果4 小时前
git amend记录
git
庸俗今天不摸鱼5 小时前
git提交代码失败?本地代码被清空了?git代码丢了怎么办?三步帮你找回来
git
摇滚侠5 小时前
零基础小白自学 Git_Github 教程,Git 命令行操作3,笔记20
笔记·git·github
摇滚侠5 小时前
零基础小白自学 Git_Github 教程,GitLFS ,笔记21
笔记·git·github