Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open default GH branch #17

Closed
PavelSafronov opened this issue Feb 13, 2021 · 3 comments
Closed

Open default GH branch #17

PavelSafronov opened this issue Feb 13, 2021 · 3 comments

Comments

@PavelSafronov
Copy link

git-peek seems to open the master branch, but if a repo has a non-master default branch this ends up opening the "wrong" branch, and it's not immediately obvious how to open the "correct" branch.

Take this repo as an example: https://github.com/jdiwnab/OrbitSim

  • The default branch is "gh-pages".
  • Running git-peek https://github.com/jdiwnab/OrbitSim results in the editor being opened to a very sparse repo, since git-peek is opening https://github.com/jdiwnab/OrbitSim/tree/master.
  • This experience doesn't match what we see when landing on https://github.com/jdiwnab/OrbitSim , and made me wonder if git-peek was still in the process of cloning the repo or if there was a bug.

The way to open the default branch is to run git-peek https://github.com/jdiwnab/OrbitSim/tree/gh-pages. But this is a url that needs to be constructed manually, as GH doesn't seem to expose it in the UI: the url for the gh-pages branch is just https://github.com/jdiwnab/OrbitSim

It would be nice if git-peek accepted a "branch" parameter or opened the default branch of the repo.

@Jarred-Sumner
Copy link
Owner

Jarred-Sumner commented Feb 13, 2021

Currently, the logic is:

I can add a --branch flag though.

The reason for this heuristic is to keep it fast. Sending one additional request before downloading the tarball would slow it down, and most repositories don't use the default branch feature

@Jarred-Sumner
Copy link
Owner

Added in v1.1.35

@Jarred-Sumner
Copy link
Owner

Jarred-Sumner commented Feb 13, 2021

Also: added a -d flag so you can just do: git peek jdiwnab/OrbitSim -d and it will figure out what the default_branch is automatically instead of guessing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants