每天都用很多git命令,输好长一大串,觉得有点浪费时间,想alias成短的,所以想参考下各位V友是怎么做的?谢谢大家啦。
|
582033May 12, 2014
1
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' |
|
graceceMay 12, 2014
2
可以参考Pro git book,常用的就那么几个吧, http://git-scm.com/book/en/Git-Basics-Tips-and-Tricks
要不然就换 on-my-zsh ,补全轻轻松松的。 |
|
dorentusMay 12, 2014
3
$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
.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 |
|
jkeyluMay 12, 2014 via iPad
5
|
|
6
用 oh my zsh 默认的alias https://github.com/robbyrussell/oh-my-zsh/wiki/Cheatsheet#git
|
|
huyiweiMay 12, 2014
7
顶~你个肺
|
|
xiaolanger1989May 12, 2014
9
没意义,zsh随便补全就好
|
|
kxxolingMay 13, 2014 via iPad
11
source tree
|
|
sandtearsMay 13, 2014
12
我都是用 zsh 的补全
|
|
lighteningMay 13, 2014
13
@ChiangDi 我也用这一套 alias。
补全还要按一下 tab,慢死了…… |
|
liul85May 13, 2014
14
用的iterm的git插件
gp = git push gco = git check out gl = git pull ...... |
|
liul85May 13, 2014
15
写错了,是oh-my-zsh的git插件
|
|
timothyyeMay 13, 2014 via Android
16
git push gps
git pull gpl git status gs git commit gc |
|
cielpyMay 13, 2014
17
|
|
ChiangDiMay 13, 2014 via Android
18
@lightening 哈哈我也觉得,所以应该告诉楼上的用自动补全的同学们,按tab键很蛋疼的,赶快用6楼的!
|
|
20
@ChiangDi 我一直在用oh-my-zsh,没想到官方有推荐的alias,真是out了,试用了一下感觉非常不错,谢谢啦。
|
|
skydiverMay 13, 2014
22
[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 |
|
skydiverMay 13, 2014
23
虽然有tab补全还是有必要alias的。。不矛盾
|
|
halfelfMay 13, 2014
25
lola = log --graph --decorate --pretty=oneline --abbrev-commit --all
|
|
toctanMay 13, 2014 via iPhone
26
用了 magit 之后才发现 git 命令行是有多么的低效,难用。
|
|
28
@jianv3 看了一下,但是Emacs不太会用啊,平时用Vim多一点。btw,希望别引起圣战啊= =#
|
|
29
|
|
toctanMay 13, 2014
30
@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 |
|
lighteningMay 13, 2014 via iPhone
31
另外推荐下tig
|
|
alexapolloMay 13, 2014
32
|
|
bitbeginMay 13, 2014
33
@alexapollo windows git下面怎么保存alias?
|
|
alexapolloMay 13, 2014
34
@bitbegin 用msysgit,标配
|
|
alexapolloMay 13, 2014
35
@bitbegin ~/.bashrc 和inputrc什么的都可以用
|
|
LucupsMay 14, 2014
36
除了 alias ll='ls -al',没有添加其他任何 alias
不觉得 gsts 这类的 alias 有多好,还是 git status 比较稳一点。 之前我也设置了很多 alias,用的时候发现很容易卡壳,遂弃之不用。 个人观点,不代表xxx,勿喷。 |
|
feng32Dec 30, 2017
37
平时用这两个个就很满足了
git st git lg1 |