【无标题】

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
相关推荐
一个程序猿老马6 小时前
012、远程协作:连接GitHub/Gitee与git remote
git·gitee·github
Lisonseekpan9 小时前
Git:如何将一个分支的特定提交合并到另一个分支?
java·大数据·git·后端·elasticsearch
pas13611 小时前
git 配置
git
独隅14 小时前
Git误操作急救手册
大数据·git·elasticsearch
水无痕simon15 小时前
03 Git 工作流程
git
一个程序猿老马16 小时前
013、推送与拉取:git push与git pull的协作流程
大数据·git·elasticsearch
每天进步一点点️17 小时前
GIT - 常用命令合辑
git
csdn_aspnet17 小时前
Git Submodule深度避坑指南,破解子模块同步混乱、版本漂移、CI失败等高频协作痛点
git·ci/cd·submodule·checklist·detached·subtree
一个程序猿老马17 小时前
011、更优雅的合并:git rebase变基操作详解
git
zhensherlock21 小时前
Protocol Launcher 系列:Working Copy 文件操作与高级命令详解
javascript·git·typescript·node.js·自动化·github·js