【无标题】

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
相关推荐
flow_code5 小时前
切换git账户
git
春生野草9 小时前
Gituee
git·gitee
222you9 小时前
Git推送本地仓库到远程
git
小贾要学习11 小时前
如何在Linux操作系统环境下使用git命令提交文件到远程仓库
linux·运维·git
J2虾虾11 小时前
WebStorm的项目绑定Git并上传到gitee
git·gitee·webstorm
虾说羊11 小时前
git分支管理介绍和stash命令
git
71-313 小时前
git 和 tortoisegit的快速使用教学(上传至gitee或GitHub)
git·gitee
唐青枫18 小时前
为什么 .gitignore 不生效?其实你忘了用 git rm --cached!
git
代码or搬砖1 天前
Git学习笔记(三)
笔记·git·学习
虾说羊2 天前
git连接远程仓库并拉去推送以及克隆命令
git