【无标题】

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
相关推荐
@PHARAOH5 小时前
WHAT - git worktree 概念
前端·git
qinqinzhang11 小时前
代码管理仓库(Git Submodules + Worktree)
git
lilili也14 小时前
Git、VScode、GitLab
git·vscode·gitlab
拥春飞翔15 小时前
AI 生成测试用例:测试知识库选「开源向量库」还「Git+Markdown」?
人工智能·git·测试用例
普修罗双战士15 小时前
高效使用 Git:从入门到精通的实战指南
java·git
摇滚侠17 小时前
创建 git 忽略文件 忽略 .obsidian 这个目录
大数据·git·elasticsearch
studytosky17 小时前
【高并发内存池】线程缓存核心原理与实现
linux·服务器·git·缓存
咕咕嘎嘎102417 小时前
问卷系统测试报告
git
水无痕simon18 小时前
04 Git基础-记录每次更新到仓
git
无限进步_18 小时前
【C++】寻找数组中出现次数超过一半的数字:三种解法深度剖析
开发语言·c++·git·算法·leetcode·github·visual studio