Git汇总

git相关问题汇总

  • Travis-CI: 使用其进行blog的自动化部署

    1. Q: 在使用travis-CI自动部署时邮箱中总是收到如下的build错误:gh-token is invalid. Details: GET https://api.github.com/user: 401
    2. A: 最后发现是如下的引号使用的中文: encrypt 'GITHUB_TOKEN=d645e71ff953dfb2dbb5b5d0b17aef80f5bdbfe1' --add
  • 解决两个账号(denleyhsiao/denleysay)交叉提交问题的方法1方法2,在hexo deploy自动提交时很有用 HostName github.com User git IdentityFile ~/.ssh/denley_say

  • 引用Github上的js文件时,如果报Content-Type之类的错误,可通过RawGit转换后使用。

  • 最后一条日志输出

    1
    git log --date=format:'%Y-%m-%d %H:%M:%S' --pretty=format:'%cd %h: %B' -n 1 > VERSION

备忘

1
2
3
4
5
6
7
8
9
10
11
12
git commit --allow-empty -m "XXX"
git commit --amend
git pull --rebase
git rebase
git cherry-pick XXX
git submodule update --init
git submodule foreach --recursive git submodule update --init
git submodule sync # 修改子模块URL/local path后
git submodule update --recursive --remote
git rm --cached third_party/CppUnit # 删除子模块后(.gitmodules & .git/config)
git update-index --assume-unchanged /path/to/file # 忽略跟踪
git update-index --no-assume-unchanged /path/to/file # 恢复跟踪

工具

  • GitBook插件
  • 权限管理工具: Gitosis
  • 代码审核服务器: Gerrit
  • GitStats
  • 手机上的Github编辑工具:prose

Github

Gitbook

参考