Git
实用技巧
常用快捷键
g - git
gst - git status
gl - git pull
gup - git pull --rebase
gp - git push
gd - git diff
gdc - git diff --cached
gdv - git diff -w "$@" | view
gc - git commit -v
gc! - git commit -v --amend
gca - git commit -v -a
gca! - git commit -v -a --amend
gcmsg - git commit -m
gco - git checkout
gcm - git checkout master
gr - git remote
grv - git remote -v
grmv - git remote rename
grrm - git remote remove
gsetr - git remote set-url
grup - git remote update
grbi - git rebase -i
grbc - git rebase --continue
grba - git rebase --abort
gb - git branch
gba - git branch -a
gcount - git shortlog -sn
gcl - git config --list
gcp - git cherry-pick
glg - git log --stat --max-count=10
glgg - git log --graph --max-count=10
glgga - git log --graph --decorate --all
glo - git log --oneline --decorate --color
glog - git log --oneline --decorate --color --graph
gss - git status -s
ga - git add
gm - git merge
grh - git reset HEAD
grhh - git reset HEAD --hard
gclean - git reset --hard && git clean -dfx
gwc - git whatchanged -p --abbrev-commit --pretty=medium
gsts - git stash show --text
gsta - git stash
gstp - git stash pop
gstd - git stash drop
ggpull - git pull origin $(current_branch)
ggpur - git pull --rebase origin $(current_branch)
ggpush - git push origin $(current_branch)
ggpnp - git pull origin $(current_branch) && git push origin $(current_branch)
glp - _git_log_prettily
常见问题
# 新建一个commit,revert everything
step1 -> git reset --hard commit_id
setp2 -> git reset --soft origin/branch_name
git blame file_name
git revert master~3...master # 目前正处于master分支
- git diff 在不加参数时,对比的是
工作区
和 快照
之间的差异,如果想比较 暂存区
和 快照
之间的差异,可以采用 git diff --cached
命令,在git 1.6之后,也可以采用diff --staged
命令
- git 通过
commit关键字
查找commit方法
git log --grep='keyWord'
SVN
常用命令
# 创建分支
svn copy http://example.com/repos/myproject/trunk http://example.com/repos/myproject/branches/branch1 -m 'create brancht'
# 切换分支
svn sw http://example.com/repos/myproject/trunk
# 合并分支
svn sw http://example.com/repos/myproject/trunk
svn merge http://example.com/repos/myproject/branches/branch1
# 删除
svn delete/rm/del
# 恢复
svn revert
# svn ignore
svn propset svn:ignore -F .svnignore .
# 解决冲突
svn resolve –accept working a.txt
svn ci -m ’some comment’ a.txt
网友评论