【无标题】

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
相关推荐
xiyuping244 小时前
在VMware上创建虚拟机Ubuntu20.04(适合学习版,包含gparted vim git的下载)
git·学习·ubuntu·vim
tan180°4 小时前
版本控制器Git(1)
c++·git·后端
ACGkaka_7 小时前
IDEA(十一)调整新版本的工具栏显示Git操作(pull、commit、push、revert等)
java·git·intellij-idea
大白的编程日记.7 小时前
【Git学习笔记】Git初识及其结构原理分析(一)
笔记·git·学习
baiyu337 小时前
成为git砖家(9): rebase进阶: 拆分commit为多个
git
Sweet_vinegar7 小时前
版本控制泄露源码 .git
git·安全·web·ctf·ctfshow
想做后端的小C10 小时前
使用SSH密钥连接本地git 和 github
git·ssh·github
ChineHe11 小时前
Git基础篇 - Linux(CentOS)源码安装Git实例
linux·git·centos
Starbright.13 小时前
Git的必要配置
git
AC使者13 小时前
解释 Git 的基本概念和使用方式。
git