Think before you speak, read before you think.

Category: Git

  • git 根据条件计算中间 commit 数量

    by

    in

    https://stackoverflow.com/a/11657647/3672812 在 feature 分支下 git rev-list –count HEAD ^master 13

  • git 一个commit 有多个 tag

    by

    in

    一个 commit 不小心打了多个 tag 输出最新的 tag LATEST_TAG=$(git describe –tags $(git rev-list –tags –max-count=1)) 根据最新的 commit 显示多个 tag git show-ref –tags | grep $(git rev-parse v0.2.0) a359509551c1a85cdfbf7675d3f7f36a8577ee38 refs/tags/v0.2.0 a359509551c1a85cdfbf7675d3f7f36a8577ee38 refs/tags/v0.3.0

  • git 查看具体一次 commit 改动的文件

    by

    in

    方法一: git –no-pager log -n 1 –name-only ${COMMIT_SHA} 方法二: git –no-pager show –stat=1000,800 ${COMMIT_SHA}

  • git-crypt

    by

    in

    gpg –list-secret-keys gpg –list-keys 导出 secret key gpg –export-secret-keys YOUR_ID_HERE > private.key 导入 secret key gpg –import private.key 查看加密文件 git-crypt status 解密整个 repo git-crypt unlock

  • pycharm terminal git bash windows

    by

    in

    windows 自带的 terminal 太难用了,用 git bash https://stackoverflow.com/questions/20573213/embed-git-bash-in-pycharm-as-external-tool-and-work-with-it-in-pycharm-window-w git bash upgrade $ git version git version 2.24.0.windows.2 $ git update-git-for-windows Or download from official site https://git-scm.com/downloads

  • clean_merged 清理已经合并的 git 分支

    by

    in

    alias clean_merged=’git checkout master && git branch –merged | grep -v master | xargs git branch -D’