摘自 git 最后推送的分支名称

Extract from git last pushed branch name

我必须(从命令行)找出最后推送的分支的名称(仅名称)。

我发现了一些命令,例如:

git rev-name                                       --> have the last id and name
git log --pretty="%H" --decorate --graph  -n 1     --> have the last id 

但是我不能把所有的都放在一起,只有名字。

我需要它,因为在 openshift/jenkins 管道中,我想触发一个构建并使用分支名称构建一个 pod。

我想我还差得远。或者也许有更好的命令。

你能帮我弄清楚最后推送的分支的名称吗?

谢谢

尝试git log -1 --pretty="format:%D" | awk -F'[, ]' '{print }'