git快捷键配置

一、命令方式直接配置

git config --global alias.co  checkout
git config --global alias.cm  commit
git config --global alias.cam 'commit -a --amend'
git config --global alias.csm 'commit -s -m'
git config --global alias.br  branch
git config --global alias.fo  'fetch origin'
git config --global alias.st  status
git config --global alias.sh  stash
git config --global alias.sp  stash pop
git config --global alias.unstage 'reset HEAD --'
git config --global alias.u  push
git config --global alias.pr  pull -r
git config --global alias.rv  review
git config --global alias.rb  rebase
git config --global alias.last log -1 HEAD
git config --global alias.lg  'log --pretty=format:"%h - %Cgreen%an%Creset, %ar : %Cgreen%s%Creset" --graph'
git config --global alias.slg  'log --pretty=format:\"%h - %Cgreen%an%Creset, %ar : %Cgreen%s%Creset\" --graph --stat'
git config --global alias.df  difftool
git config --global alias.sdf  'difftool --stat'
git config --global alias.ft  fetch

二、配置文件.gitconfig的方式

编辑或新增 /home/.gitconfig 文件,增加如下内容:

[url "ssh://xxxx@gerrit.xxx.com.cn"]
    pushInsteadOf = ssh://xxx@gerritro.xx.com.cn
[alias]
    co = checkout
    cm = commit
    cam = commit -a --amend
    csm = commit -s -m
    br = branch
    fo = fetch origin
    st = status
    sh = stash
    sp = stash pop
    unstage = reset HEAD --
    pu = push
    pr = pull -r
    rv = review
    rb = rebase
    last = log -1 HEAD
    lg = log --pretty=format:\"%h - %Cgreen%an%Creset, %ar : %Cgreen%s%Creset\" --graph
    slg = log --pretty=format:\"%h - %Cgreen%an%Creset, %ar : %Cgreen%s%Creset\" --graph --stat
    df = difftool
    sdf = difftool --stat
    ft = fetch
[color]
    ui = true
[difftool]
    prompt = false
[diff]
    tool = vimdiff
[core]
    editor = vim
    quotepath = false
[merge]
    tool = vimdiff
[mergetool]
    prompt = false
[user]
    email = xxx
    name = xxx

三、添加与删除git快捷键全局配置

        参考:添加和删除git全局配置(git config --global)_wang的博客-优快云博客

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值