0

I would like to checkout the latest commit on an active repository of any branch. That's the first commit when you sort your Bitbucket repo in the "Network" section.

My use case is a tool which uses code from latest changes in multiple submodules to analyze if those changes have led to a better evaluation metric. I'm doing it though a Jenkinsfile

I tried:

git checkout HEAD

but that only checks out the latest commit in the current branch.

myselfmiqdad
  • 2,518
  • 2
  • 18
  • 33

2 Answers2

1

git rev-list -n1 origin --branches=* | xargs git checkout

Jim
  • 317
  • 1
  • 13
0
git checkout :/.

The :/ syntax is "the most recent commit whose message contains a match for the expression", and . is "any character".

jthill
  • 55,082
  • 5
  • 77
  • 137