
要对比本次 push 到上次 push 的 diff,怎么能获取到上次 push 操作的 commit 呢
1 az09py OP 问题有点错误,应该是:在本次 push 时,获取最近一次的 pull/push 的 commit |
2 geelaw 2018 年 7 月 17 日 你或许想要比较 remote/branch_name 和 local_branch_name |
3 Keller0 2018 年 7 月 17 日 via Android 你可能需要看 commit 的 msg 或者 tag |
4 malusama 2018 年 7 月 17 日 git log |
5 Oneneuuu 2018 年 7 月 17 日 via Android gitlog 外加文本过滤一下吧 |
6 rabbbit 2018 年 7 月 17 日 git reflog show origin/master |
7 alvinbone88 2018 年 7 月 17 日 git rev-parse HEAD |
8 gnaggnoyil 2018 年 7 月 18 日 这难道不是个 A-B 问题吗…… `git diff HEAD~1 HEAD` |
9 gnaggnoyil 2018 年 7 月 18 日 s/A-B 问题 /X-Y 问题 /g |
10 siteshen 2018 年 7 月 18 日 还是不太明白"最近一次的 pull/push 的 commit",不过下面的命令能得到远端分支的最后一个 commit git fetch; git rev-parse origin/${BRANCH} |
12 az09py OP @gnaggnoyil 这个是这次 commit 和上次 commit 的吧 |
14 az09py OP @siteshen 请问大佬 获取远端跟踪分支最后一个 commit,有没有不要${branch}的命令,或者有没有获取当前跟踪分支名的命令呢 |
15 siteshen 2018 年 7 月 19 日 @az09py `$(BRANCH}` 替换为 `$(git rev-parse --abbrev-ref HEAD)` 就行。 另外 @gnaggnoyil 说的 X-Y 问题应该是这个: https://coolshell.cn/articles/10804.html 意思是也许直接问你要解决的(完整的)问题,比问一个你提出的解决方案的一部分更好。 |