Cheat Sheet速查表
跳转到主要内容

Git 扩展命令 速查表

本文根据 Devhints / Git extras 翻译。代码示例及版本范围沿用原文。

`git-extras` 中部分实用工具的 `git-extras` 实用工具。

参考资料

Git-flow 工作流

$ git feature myfeature
  switched to branch 'feature/rofl'

$ ...
$ git checkout develop
$ git feature finish myfeature
  merging 'feature/rofl' into develop
  deleted branch 'feature/rofl'

此外 git-bug 以及 git-refactor.

分支

$ git delete-merged-branches
  # hint: do `git remote prune origin` after

$ git create-branch development
$ git delete-branch development

$ git fresh-branch gh-pages

查看/检查

$ git summary   # repo age, commits, active days, etc
$ git impact    # impact graph
$ git effort    # commits per file

GitHub

$ git fork strongloop/express
# sync your fork with the original repository:
$ git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git
$ git fetch upstream; git merge upstream/master

标签

$ git release v1.0.0           # commit, tag, push-tags
$ git delete-tag v1.0.0

便捷功能

$ git ignore "*.log"

锁定

假设更改不会被提交。

$ git lock config/database.yml
$ git unlock config/database.yml

其他

$ git obliterate secret.yml   # remove all references to it

参考资料