【无标题】

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
相关推荐
MrLi01041 小时前
在git中同时配置gitcode和github访问权限
git·github·gitcode
越来越无动于衷1 小时前
Git 团队协作完全指南:从基础到高级应用
git
小怪兽会微笑1 小时前
如何上传github(解决git的时候输入正确的账号密码,但提示认证失败)
git·github
Komorebi_999914 小时前
Git常用指令
git·web
一小池勺16 小时前
🚀 Git 如何让文件存在于远程仓库却不被本地追踪?
git·github
五月高高18 小时前
Idea使用git不提示账号密码登录,而是输入token问题解决
git
魏 无羡18 小时前
idea实现git版本回退的常见场景
java·git·intellij-idea
ergevv21 小时前
不同场景下git指令的搭配
git·源代码管理·代码
不了_谢谢1 天前
项目仓库文件太大怎么清理?如何清理git仓库大文件记录?
git