LoginSignup
0

More than 5 years have passed since last update.

最新のstableブランチ名をgitコマンドのみで取得する方法

Posted at

GitLab flowを運用していて、最新のstableブランチを取得する場合、
今までgrepやheadやsortを使って取得していたのですが、git for-each-refコマンドで取得できたのでメモとして残しておきます。

git for-each-ref --format='%(refname:short)' --sort=-authordate --count 1 "refs/remotes/origin/stable"

参考
https://git-scm.com/docs/git-for-each-ref

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0