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
相关推荐
Lw老王要学习19 分钟前
VScode 使用 git 提交数据到指定库的完整指南
windows·git·vscode
去旅行、在路上22 分钟前
Git & Svn
git·svn
abcnull1 小时前
github中main与master,master无法合并到main
git·github
养意6 小时前
git提交代码和解决冲突修复bug
git·bug
码农黛兮_4620 小时前
Git 常用命令大全
git
一弓虽20 小时前
git 学习
git·学习
疯狂的沙粒1 天前
如何通过git命令查看项目连接的仓库地址?
大数据·git·elasticsearch
qq_254617771 天前
Gerrit+repo管理git仓库,如果本地有新分支不能执行repo sync来同步远程所有修改,会报错
git
π大星星️1 天前
Git分布式版本控制工具
分布式·git
kingbal1 天前
IDEA:配置 Git 需要完成 Git 路径设置、账号认证以及仓库关联三个主要步骤
git·idea