【无标题】

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
相关推荐
武昌库里写JAVA6 小时前
SpringBoot+Vue 项目介绍
java·javascript·git·sql·ai
Hvitur2 天前
Git - 多分支合并
git·github
考虑考虑3 天前
git刷新远程分支列表
git·后端·gitlab
AI大模型-小华3 天前
Codex 自动测试怎么用?从生成测试用例到修复失败用例
git·测试用例·ai编程·软件开发·codex·chatgpt pro·codex cli
七分辣度4 天前
GitHub/Git 常用命令及使用场景
git·github
慧都小项4 天前
MyEclipse Inline Diff 实用指南:逐处核对 AI 修改再提交
git·ai编程·myeclipse·java 代码审查·ai 代码修改
德育处主任5 天前
让 Claude Code 在你睡觉时接着干活:tmux、权限策略与验收清单
git·ai编程·命令行
为思念酝酿的痛7 天前
Git基本操作
git·github
wno7048 天前
常用的Git命令清单
大数据·git·elasticsearch
真上帝的左手8 天前
3. 代码管理-Git-进阶
git·源代码管理