每天都用很多git命令,输好长一大串,觉得有点浪费时间,想alias成短的,所以想参考下各位V友是怎么做的?谢谢大家啦。
1
582033 May 12, 2014
104 alias gf='git-ftp'
105 alias gtst='git status' 106 alias gtlg='git log' 107 alias gtlg1='git log --pretty=format:"%h %an %s" --color=auto' 108 alias gtlg2='git log --pretty=oneline' 109 alias gtbr='git branch' 110 alias gtco='git commit' 111 alias gtdi='git diff' 112 alias gv='git svn' |
2
gracece May 12, 2014
可以参考Pro git book,常用的就那么几个吧, http://git-scm.com/book/en/Git-Basics-Tips-and-Tricks
要不然就换 on-my-zsh ,补全轻轻松松的。 |
3
dorentus May 12, 2014
$HOME/.gitconfig
[alias] lg = log --graph --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(bold white)— %an%C(reset)%C(bold yellow)%d%C(reset)' --abbrev-commit --date=relative --show-signature 就这一个,忘了从哪抄来的了。 |
4
TankyWoo May 12, 2014 .gitconfig:
[alias] st = status l = log --pretty=oneline -n 20 --graph --abbrev-commit ll = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- b = branch ci = commit ca = commit -a pl = pull ps = push co = checkout zsh git: alias gst="git status" https://github.com/tankywoo/dotfiles/blob/master/.gitconfig |
5
jkeylu May 12, 2014 via iPad
|
6
ChiangDi May 12, 2014 用 oh my zsh 默认的alias https://github.com/robbyrussell/oh-my-zsh/wiki/Cheatsheet#git
|
7
huyiwei May 12, 2014
顶~你个肺
|
9
xiaolanger1989 May 12, 2014
没意义,zsh随便补全就好
|
11
kxxoling May 13, 2014 via iPad
source tree
|
12
sandtears May 13, 2014
我都是用 zsh 的补全
|
13
lightening May 13, 2014
@ChiangDi 我也用这一套 alias。
补全还要按一下 tab,慢死了…… |
14
liul85 May 13, 2014
用的iterm的git插件
gp = git push gco = git check out gl = git pull ...... |
15
liul85 May 13, 2014
写错了,是oh-my-zsh的git插件
|
16
timothyye May 13, 2014 via Android
git push gps
git pull gpl git status gs git commit gc |
17
cielpy May 13, 2014
|
18
ChiangDi May 13, 2014 via Android
@lightening 哈哈我也觉得,所以应该告诉楼上的用自动补全的同学们,按tab键很蛋疼的,赶快用6楼的!
|
20
precisi0nux OP @ChiangDi 我一直在用oh-my-zsh,没想到官方有推荐的alias,真是out了,试用了一下感觉非常不错,谢谢啦。
|
22
skydiver May 13, 2014
[alias]
br = branch -v re = remote -v rb = rebase rbm = rebase master rbom = rebase origin/master cp = cherry-pick ci = commit co = checkout di = diff -b ps = push pl = pull st = status logp = log -p -b --no-merges --graph logs = log --stat -b --no-merges --graph diff = diff -b diffs = diff --stat -b |
23
skydiver May 13, 2014
虽然有tab补全还是有必要alias的。。不矛盾
|
25
halfelf May 13, 2014
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
|
26
toctan May 13, 2014 via iPhone
用了 magit 之后才发现 git 命令行是有多么的低效,难用。
|
28
precisi0nux OP @jianv3 看了一下,但是Emacs不太会用啊,平时用Vim多一点。btw,希望别引起圣战啊= =#
|
29
precisi0nux OP |
30
toctan May 13, 2014
@jianv3 为什么在有更好的方式前提下还要去习惯呢?
@precisi0nux Vim, Sublime, Textmate 因该都有相应的 git 集成,但是几乎可以肯定的是再也没有比 magit 更强大的了。在编辑器里使用 git 的好处: - 减少了编辑器与窗口之间的切换 - 极大的降低了击键次数,stage -> s, commit -> c, fetch -> f, branch -> b - 方便简化了一部分操作,举几个例子,比如对某个文件我想放在两个 commit 里,直接选中改动摁 s; blame, 直接在编辑器里显示那些行是哪个人什么时候哪个 commit 改的; interactive rebase, 一般就直接手动编辑,不仅容易打错而且慢,快捷键就 p -> pick, s -> squash, a -> abort 用 Emacs 的同学强烈推荐 Magit + projectile, 可能是 Emacs 最好的俩插件了。另外,无论是新手还是老手,试试 Prelude by bbatsov - https://github.com/magit/magit - https://github.com/bbatsov/projectile - https://github.com/bbatsov/prelude |
31
lightening May 13, 2014 via iPhone
另外推荐下tig
|
32
alexapollo May 13, 2014
|
33
bitbegin May 13, 2014
@alexapollo windows git下面怎么保存alias?
|
34
alexapollo May 13, 2014
@bitbegin 用msysgit,标配
|
35
alexapollo May 13, 2014
@bitbegin ~/.bashrc 和inputrc什么的都可以用
|
36
Lucups May 14, 2014
除了 alias ll='ls -al',没有添加其他任何 alias
不觉得 gsts 这类的 alias 有多好,还是 git status 比较稳一点。 之前我也设置了很多 alias,用的时候发现很容易卡壳,遂弃之不用。 个人观点,不代表xxx,勿喷。 |
37
feng32 Dec 30, 2017
平时用这两个个就很满足了
git st git lg1 |