【无标题】

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
相关推荐
小兔崽子去哪了12 分钟前
Git 专题
git
金米kk25 分钟前
git pull时报错Your local changes to the following files would…的解决办法
git
超级罗伯特26 分钟前
git一次性完成仓库下载及所有分支获取
git·git仓库拉取
BUTCHER51 小时前
Git 基础命令
git
M malloc1 小时前
当你有两个git账号时,此时你gitpush冲突后如何解决push问题
git
cuijiecheng20183 小时前
Linux控制台下git使用图形化界面进行文件对比
linux·运维·git
南_山无梅落4 小时前
Git 结合 Gitee 使用教程:从入门到实战
git·gitee
这就是佬们吗4 小时前
Windows 的 CMD 网络环境:解决终端无法联网与更新的终极指南
java·windows·git·python·spring·maven
醇氧13 小时前
【git】WARNING: connection is not using a post-quantum key exchange algorithm.
git
一只程序熊14 小时前
Git不常用操作记录
git