【无标题】

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
相关推荐
Jurio.1 小时前
本机开发 + 多机执行的极简远端运行工具
linux·git·python·github·远程工作
阿巴~阿巴~2 小时前
Git版本控制完全指南:从入门到实战(简单版)
linux·服务器·git
遇满则缺2 小时前
新手第一次使用gitee全流程(附上常见错误以及解决方法)
git·gitee
SKILL·NULL4 小时前
如何为GIT设置全局勾子,为每次提交追加信息
git
不做超级小白9 小时前
开源项目二开为何推荐使用 `git clone --depth 1`?
git·开源
星晨雪海12 小时前
Idea中使用Git详细教程
git
丶党玲儿13 小时前
AI-agent工程化(开源git分享)
人工智能·git·开源
笑虾13 小时前
Git 学习笔记 - 合并
git
明月夜&14 小时前
Ubuntu 20.04 Docker 部署 Ollama + DeepSeek-Coder:本地 AI 编程助手实战
git·vscode·ubuntu·docker·大语言模型·智能体
如此热烈走向夏天14 小时前
科研中常用的GIT常用指令
git