0

I want to get the refs for a remote git repo (I am not interested in the code).

I am connecting over ssh. What commands would I need to execute to just download the refs information?

Derek Ekins
  • 11,215
  • 6
  • 61
  • 71
  • 1
    `refs` [means branches and tags](https://git-scm.com/docs/git-fetch), which means commits, which means code. Please clarify what, exactly, you want to fetch. – JDB Jan 11 '18 at 15:01
  • Maybe you are looking for the [`--depth=` option](https://git-scm.com/docs/git-fetch#git-fetch---depthltdepthgt), so that you don't have to download a lot of commits? – JDB Jan 11 '18 at 15:05

3 Answers3

2

You probably want to run some version of ls-remote

By default it only shows you the branches:

git ls-remote ssh://user@server/path/to/repo.git

use -t to show the tags:

git ls-remote -t ssh://user@server/path/to/repo.git

add -h to show the branches also:

git ls-remote -t -h ssh://user@server/path/to/repo.git

Ben
  • 1,287
  • 15
  • 24
  • yeah this is the kind of thing I am looking for - I also want to see which commits make up the branch - is that possible? – Derek Ekins Jan 11 '18 at 15:26
  • There is no `remote log` command that I am aware of, nor do any turn up in my google searches. Closest thing I know of to do what you want is to to something like: `ssh user@server "cd path/to/repo.gt && git log"` See: https://stackoverflow.com/questions/1178389/browse-and-display-files-in-a-git-repo-without-cloning – Ben Jan 11 '18 at 15:42
0

I guess git ls-remote is the Git command you are looking for.

axiac
  • 68,258
  • 9
  • 99
  • 134
-1
git fetch origin branch

fetches updates from origin for a single branch.

git remote update origin

fetches updates from origin for all branches.

phd
  • 82,685
  • 13
  • 120
  • 165