【无标题】

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
相关推荐
炸膛坦客2 小时前
Git 和 GitHub:(十四)rebase 到某个有新提交的远程仓库的分支
git·github
炸膛坦客16 小时前
Git 和 GitHub:(十二)基于远程仓库的某一个分支的某一笔提交创建新分支
git·github
炸膛坦客17 小时前
Git 和 GitHub:(十三)改分支名
git·github
他们叫我秃子17 小时前
Git 使用指南笔记:从入门到团队协作
git
铁锚21 小时前
Git设置自动推送到同名远端分支
git
起个破名想半天了1 天前
Git 本地项目关联远程仓库教程
git·github·git教程
lazy H1 天前
Git worktree 怎么用?同时开发多个分支完整教程
大数据·git·后端·学习·搜索引擎·github
重生的黑客1 天前
Git 本地版本管理与分支管理:从零理解工作区、回退、冲突与开发流程
数据库·git·elasticsearch
Cx330_FCQ2 天前
Tmux使用
服务器·git·算法
xxwl5852 天前
Git 完整学习笔记:从入门到团队协作
笔记·git·学习