0

I need to install the most recent branch of a program that uses a deprecated variable. How can I do so?

I tried using

git grep <variable>  $(git rev-list --all)

but it 1) only outputs commit hash values and 2) does not gives the last branch.

user3563894
  • 331
  • 3
  • 13
  • Commits don't have names, they are identified by hashes. It's very unclear what your asking or want to do. If you have a hash you can [check that out](https://stackoverflow.com/questions/7539130/go-to-particular-revision) – Liam Jul 03 '19 at 10:54
  • I fixed it to a branch – user3563894 Jul 03 '19 at 10:56
  • The goal eventually is to checkout the branch with the deprecated variable – user3563894 Jul 03 '19 at 11:00

1 Answers1

3

Try

git grep <variable>  $(git for-each-ref refs/heads refs/remotes/origin --format="%(refname)")

The git for-each-ref command returns branches (by refs/heads) and remote branches (by refs/remotes/origin). git grep tries to find the keyword from the tip of these branches.

ElpieKay
  • 27,194
  • 6
  • 32
  • 53