让 Git 提醒我使用 switch/restore 而不是 checkout

问题描述 投票:0回答:1

我想教我的双手使用新的

git switch
git restore
,而不是在所有事情上使用
git checkout
(请参阅“git switch”和“git checkout”之间有什么区别)。每当我使用旧样式时,配置我的 Linux 终端 (Bash) 来提醒我,甚至抱怨,什么是好方法?

bash git
1个回答
0
投票

.bashrc 函数

git() {
    if [[ "$1" = checkout ]]; then
        echo 'Use switch or restore!' >&2
        return 1
    fi

    command git "$@"
}
© www.soinside.com 2019 - 2024. All rights reserved.