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
相关推荐
__Witheart__15 分钟前
Git 如何从某个 commit 新建分支
git
Klaus_Wei11 小时前
git 高级命令模式典型应用--“同步云端 + 清理垃圾分支”的一键命令
git·git高级用法·git同步云端·git清理垃圾分支
妙娲种子12 小时前
配置git/创建第一个智能相册保存快照
git
what_201812 小时前
git一个账号在两台电脑登录 出现不同用户名
git
困鲲鲲12 小时前
ROS2系列 (13) : 常用Git指令入门(本地Git)
git·ros2
☆cwlulu17 小时前
git分支管理详解
开发语言·git·青少年编程
脑子不好的小菜鸟19 小时前
用vscode连接远端ubuntu无法git push,vscode无法连接centos
git·vscode·ubuntu·centos
__Witheart__21 小时前
Git 如何修改已有的分支名称
git
秦jh_1 天前
【git】分支管理
git
百锦再1 天前
第5章 所有权系统
运维·git·python·eclipse·go·github·负载均衡