早上更新项目代码,发现日志中出现了很多新的分支,莫名其妙多出 stg1-stg9 这么九个分支。使用 git branch -a 查看如下
master * product_rebuild__v2 stg1 remotes/origin/20190704_danran_product_rebuild_v1 remotes/origin/20190718_product_rebuild__v2 remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/pre remotes/origin/pro remotes/origin/product_rebuild__v2 remotes/origin/prt remotes/origin/stg remotes/origin/stg1 remotes/origin/stg2 remotes/origin/stg3 remotes/origin/stg4 remotes/origin/stg5 remotes/origin/stg6 remotes/origin/stg7 remotes/origin/stg8 remotes/origin/stg9
于是开始查询是谁在搞鬼,使用如下命令查询
git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n
查询日志如下,原来是 pipixia 同学在做测试呀。
➜ product-gateway git:(product_rebuild__v2) ✗ git for-each-ref --format='%(committerdate) %09 %(authorname) %09 %(refname)' | sort -k5n -k2M -k3n -k4n Thu Jul 18 22:06:20 2019 +0800 baiju refs/heads/master Thu Jul 18 22:06:20 2019 +0800 baiju refs/remotes/origin/20190704_danran_product_rebuild_v1 Thu Jul 18 22:06:20 2019 +0800 baiju refs/remotes/origin/20190718_product_rebuild__v2 Sun Jul 28 17:21:56 2019 +0800 听风 refs/stash Tue Jul 30 04:20:44 2019 +0000 明镜 refs/heads/stg1 Wed Jul 31 02:41:23 2019 +0000 明镜 refs/remotes/origin/stg1 Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/HEAD Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/master Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/pre Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/pro Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/prt Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg2 Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg3 Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg4 Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg5 Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg6 Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg7 Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg8 Wed Jul 31 02:42:10 2019 +0000 pipixia refs/remotes/origin/stg9 Wed Jul 31 10:40:55 2019 +0800 mingjing refs/heads/product_rebuild__v2 Wed Jul 31 10:40:55 2019 +0800 mingjing refs/remotes/origin/product_rebuild__v2
未经允许请勿转载:程序喵 » Git 如何查看分支是谁创建的?