Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Git 进阶指南(2019 修订版) #7

Open
kaiye opened this issue Jan 19, 2016 · 3 comments
Open

Git 进阶指南(2019 修订版) #7

kaiye opened this issue Jan 19, 2016 · 3 comments

Comments

@kaiye
Copy link
Owner

kaiye commented Jan 19, 2016

点此前往电子书《Git 进阶指南》: https://yekai.net/gb


目录

概念

常见问题

Git Alias Cheat Sheet

Alias Command Remark
grv git remote -v 查看远程分支列表
gf git fetch
gl git pull
gup git pull --rebase
gupa git pull --rebase --autostash
glum git pull upstream master
grb git rebase
gm git merge
gba git branch -a
gsu git submodule update 更新子仓库
gst git status
gaa git add -all 将当前版本库所有改动提交至暂存区
gp git push
ggp git push origin "${*}" 可指定分支或标签名,默认当前分支
ggsup git branch --set-upstream-to=origin/$(git_current_branch) 当前分支与远程同名分支关联
gcmsg git commit -m
gco git checkout
gcb git checkout -b 从当前分支新建并转向新分支
glol git log --graph --pretty='%Cred%h%Creset -%C(auto)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' 格式化版本号、提交时间、作者信息的日志
gwip git add -A; git rm $(git ls-files --deleted) 2> /dev/null; git commit --no-verify -m "--wip--" 将当前新增与改动的文件做一次临时提交
gunwip git log -n 1 | grep -q -c "--wip--" && git reset HEAD~1 从上一次 gwip 恢复
grhh git reset HEAD --hard
gclean git clean -df
gpristine git reset --hard && git clean -dfx 注意 .gitignore 里的 node_modules 也会被清除
gsta git stash save
gstl git stash list
gstp git stash pop
gtv git tag | sort -V
gdct git describe --tags `git rev-list --tags --max-count=1` 当前最近 tag 版本信息
gca! git commit -v -a --amend 将当前修改追加至上一次提交,并修改提交记录

注:本书所有章节 git 命令行代码,会在行内注释中标注对应的 zsh alias 。

@jiguang
Copy link

jiguang commented Feb 4, 2016

好厉害!

@kaiye
Copy link
Owner Author

kaiye commented Feb 15, 2016

新增 oh-my-zsh git plugin cheatsheet :https://github.com/robbyrussell/oh-my-zsh/wiki/Plugin:git

@kaiye
Copy link
Owner Author

kaiye commented Jul 18, 2018

新增 subtree 与 submodule 的对比

@kaiye kaiye changed the title Git 进阶指南 Git 进阶指南(2019 修订版) Feb 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants