【无标题】

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
相关推荐
疯狂的沙粒7 小时前
如何通过git命令查看项目连接的仓库地址?
大数据·git·elasticsearch
qq_254617778 小时前
Gerrit+repo管理git仓库,如果本地有新分支不能执行repo sync来同步远程所有修改,会报错
git
π大星星️9 小时前
Git分布式版本控制工具
分布式·git
kingbal9 小时前
IDEA:配置 Git 需要完成 Git 路径设置、账号认证以及仓库关联三个主要步骤
git·idea
司徒小夜21 小时前
处理git没做修改,但是文件显示变更的情况
git
m0_749317521 天前
vscode里如何用git
ide·git·vscode
Hello.Reader1 天前
Git 安装全攻略Linux、macOS、Windows 与源码编译
linux·git·macos
王景程1 天前
SELinux是什么以及如何编写SELinux策略
git·github
Chuncheng's blog1 天前
如何基于Mihomo Party http端口配置git与bash命令行代理
git·http·bash
Tom Boom1 天前
Git常用命令完全指南:从入门到精通
大数据·git·elasticsearch·docker·自动化测试框架