git自定义命令使用

1.Linux~/.bashrc内容

复制代码
function custom_git {
    # 在 Windows 或 Unix 平台上设置 GIT_SSH_COMMAND
    export GIT_SSH_COMMAND="ssh -i $custom_ssh"
    git "$@"
}

# 设置 custom_ssh路径 
export custom_ssh="$HOME/.ssh/id_custom_sshkey"

2.Windows~/.bashrc内容

shell 复制代码
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi


function custom_git {
    # 在 Windows 或 Unix 平台上设置 GIT_SSH_COMMAND
    export GIT_SSH_COMMAND="ssh -i $custom_ssh"
    git "$@"
}

# 设置 custom_ssh 路径
export custom_ssh="$HOME/.ssh/custom_sshKey"

3.使用

复制代码
custom_git status
相关推荐
蓁蓁啊3 小时前
GIT使用SSH 多账户配置
运维·git·ssh
相与还8 小时前
IDEA和GIT实现cherry pick拣选部分变更到新分支
git·elasticsearch·intellij-idea
刘志辉15 小时前
git指令
git
2501_9167665418 小时前
【Git学习】初识git:简单介绍及安装流程
git·学习
孤独的追光者20 小时前
Git 完整流程:从暂存到推送
git
平平无奇。。。20 小时前
版本控制器之Git理论与实战
linux·git·gitee·github
这周也會开心1 天前
Git介绍和使用
git
小龙报1 天前
《彻底理解C语言指针全攻略(3)》
c语言·开发语言·windows·git·创业创新·学习方法·visual studio
前端备忘录2 天前
创建好git项目仓库后如何将本地项目传上去
git
代码or搬砖2 天前
Git学习笔记(二)
笔记·git·学习