【无标题】

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
相关推荐
~~李木子~~1 小时前
通过git上传项目到码云和GitHub操作手册
git·gitee·github
songyuc4 小时前
【Git】请帮忙解释一下“git reset”
git·elasticsearch
Komorebi_99997 小时前
使用Git创建自己的分支的操作指南
git
~~李木子~~11 小时前
git仓库管理
git
秦jh_11 小时前
【git】远程操作
git
tianming201917 小时前
Gogs迁移到Gitea不完全指南
git·后端
QT 小鲜肉19 小时前
【Git、GitHub、Gitee】GitLab的概念、注册流程、远程仓库操作以及高级功能详解(超详细)
git·qt·gitee·gitlab·github
你的人类朋友1 天前
✍️记录自己的git分支管理实践
前端·git·后端
wVelpro1 天前
git diff 输出空,但 git status 提示 Motified(M)解决办法
git
high20111 天前
【Git】-- Rebase 减少 Commit 次数指南
大数据·git·elasticsearch