【无标题】

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
相关推荐
import_random13 小时前
[git]只有git,没有github, 如何工作
git·github
import_random13 小时前
[git]先创建远程仓库or先创建本地项目
git·github
Linux实战笔记16 小时前
rebase 变基引发提交哈希重写与指针机制分析
git·rebase·提交哈希·分支模型·代码合并
小稀土12317 小时前
私有化研发协同系统并行期:旧 Jira 与新 Git 并存 6 条数据规则
git
Madison-No717 小时前
Git版本控制工具(二)
git
Brookty21 小时前
Git 与 GitHub|第一阶段:仓库、版本历史与 Git 对象模型(上篇)
git·github
Kimnol1 天前
我的第一次 Git 贡献:从 fork 到合并 PR #3130
git
鬼手点金2 天前
消息的四种角色
java·前端·人工智能·git·深度学习
齐 飞2 天前
idea中git误操作撤回git reset --hard ‘HEAD@{1}‘
java·git·intellij-idea
长成一棵参天树3 天前
React15 vs React16 核心区别
git·vscode