Bash git ls-remote get last commit of a repository by specifying the branch

Viewed 31
git ls-remote --heads https://github.com/nanashili/AuroraEditor

9d84315555abdc1502ea2faf8c67401f4a27c226    refs/heads/179-toolbar-branch-selector-shows-when-no-git-repo
474bb8ab6629021769260145184983eb76b8c9d1    refs/heads/branch-delete-menu
afefeb5bbe89e8618e3f2ca6ff93718383f83145    refs/heads/development-main
474bb8ab6629021769260145184983eb76b8c9d1    refs/heads/file-creation
d24623b97fc863238b88179f03a24dca72aa44e9    refs/heads/git-init-fix
61fa98ba6a7b6f2fa518d3406016c304cbc83a9b    refs/heads/rename-branches

I have the following command which gives me the latest commit code of all branches of a specific repository.

I need to know the commit code of a specific repository.

That is, filter by the second column which would be the branch, just return its commit code.

For example, I want the commit code of the development-main branch, it should return "afefeb5bbe89e8618e3f2ca6ff93718383f83145".

Can you give me a hand?

0 Answers
Related