【无标题】

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 Worktree开发指南
git
Patrick_Wilson6 小时前
为什么gitlab的MR会默认有一个merge commit
前端·git·gitlab
是乐乐啊呀6 小时前
版本控制 GIT 和 SVN
git·svn
夜鸣笙笙9 小时前
Git详细安装流程
git
瑞码空间1 天前
git知识点黄金笔记
笔记·git·elasticsearch
----云烟----1 天前
Git 提交忽略某些文件方法
git
切糕师学AI1 天前
如何查看已合并到 master 分支的所有分支?Git 分支清理指南
大数据·git·elasticsearch
DevUp1 天前
一个管「引」,一个管「抄」:Submodule 和 Subtree 到底差在哪
git·前端工程化
lingran__1 天前
Git 完全指南(三):远程仓库与标签管理
开发语言·git·gitee·ssh·团队协作·远程仓库·分布式版本控制
lingran__2 天前
Git 完全指南(二):分支管理
git·分支管理·版本控制·团队协作·多人开发·git flow