【无标题】

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
相关推荐
我家媳妇儿萌哒哒14 小时前
git:无法推送refs到远端。您可以试着运行“拉取”功能,整合您的更改。
git
驯龙高手_追风17 小时前
Gitlab本地服务器搭建及配置-详细教程
git·github
czhc114007566318 小时前
6.11:halcon,Sqlserver;项目sql连接;git
git·sql·sqlserver
炸炸鱼.19 小时前
Git+Jenkins 基本使用:从入门到实战(知识点大全)
运维·git·jenkins
戴国进21 小时前
git stash 用法详解
git
木雷双雄71 天前
Git 版本回退操作指南
git
m0_579146651 天前
已被 Git 追踪的本地修改文件如何实现临时忽略
git
糖少主1 天前
WSL中使用Beyond Compare 3/4/5作为difftool
git·wsl·beyond compare·difftool
console.log('npc')2 天前
Git版本管控:git reset \+ git push \-f 原理、实操与避坑指南
git
恋喵大鲤鱼2 天前
git reflog
git·git reflog