11 ms·
Show HN: git-peek – git repo to local editor instantly
- orsenthil 6y agoVery good work and a excellent use a git sub-command. Although, I appreciate github1s and perhaps future is there. I am currently more likely to use git peek (with it's search feature).
- Brian_K_White 6y agoDoes this work with any git repo? Else, shouldn't this be called github-peek? Are you the author? Else why are you posting it as a Show HN?
- Jarred 6y agoIt works with non GitHub repos, but it’s not as fast. When it detects a GitHub link, it downloads the tarball from GitHub & and separately downloads the specific file linked (or the readme) using JSDelivr as a CDN. This is much faster than a normal clone When it’s a regular git link, it does a partial clone and opens in your editor.
- Brian_K_White 6y agoThank you. I apologize. I don't know why I got the idea you weren't the author. It's not like the account names don't imply it. I was aggressive because only the day before I too saw github1s and found it mostly pointless and this seemed the same. You have answered both questions though, so, well that's why I phrase challenges as questions, in case my head is up my ass.
- Shared404 6y agoWhy so aggressive? All of the above can be easily seen by looking at the provided link for about five seconds.
- panzerboy 6y agoNice idea but I have an issue. I'm on the new MBP with the M1 and I have code-insiders installed as it runs natively. So I tried the following: git peek https://github.com/ylukem/pin-go https://github.com/ylukem/pin-go -e code-insiders It works, it downloads the repo, opens the editor but it immediately deletes it! Any idea how to fix this?
- Jarred 6y agoAuthor here — this is actually not a bug, but a deliberate design decision (so long as you meant, when the editor closes). I’m sorry for the confusion. git peek is not a faster alternative to git clone. It’s for quickly reading other people’s code without needing to keep it around for writing or updating. That being said, I could make it not delete the code after the editor closes and keep it somewhere. It just won’t have access to the git tree and other things you’d expect. I could add a flag like —keep that doesn’t delete it and let’s you pass a place to put it.
- testing_1_2_3_4 6y agoThanks for jumping in Jarred. My mistake, I wasn't aware of the rule and just wanted to share you project because it was so cool.
- Jarred 6y agoTurns out this was a bug – it wasn't properly adding `--wait` when opening the editor. Its fixed in 1.1.15.
- salmon 6y agoRelated project that was posted to HN yesterday: github1s.com - just add "1s" to any github URL and it opens the repo in VS Code in your browser
- reustle 6y agoLink for the curious https://news.ycombinator.com/item?id=26083919 https://news.ycombinator.com/item?id=26083919
- rahimnathwani 6y agoYes, the README says "This was inspired by github1s.com."
- Jarred 6y agoI read lots of code on GitHub, so I got really excited when I saw github1s (https://news.ycombinator.com/item?id=26083919 https://news.ycombinator.com/item?id=26083919), but was disappointed when I saw that search doesn’t work (https://news.ycombinator.com/item?id=26085540 https://news.ycombinator.com/item?id=26085540). So I hacked together `git peek` on Tuesday night. It works with any git repository, but uses GitHub’s API to be faster when it can.
- ta1234567890 6y agoDoes it work with private repos? I tried github1s with a private repo and it threw an authorization error.
- Jarred 6y agoNow it does. If you have the `GITHUB_TOKEN` environment variable set to a personal access token or if you happen to use the hubs github cli it will work
- ta1234567890 6y agoCool, thank you!
- nicomeemes 6y agoAnyone know why I get ECONNREFUSED? https://imgur.com/Cd22Gwb https://imgur.com/Cd22Gwb
- deleted 6y ago[deleted]
- alexdme 6y agoI like that this doesn't assume what editor and git remote someone uses unlike github1s which is further pushing the development community toward centralizing on Github+VScode. Diversity is good. You inspired me to write my own. Here is a 9-line shell script version of git-peak: https://git.sr.ht/~alexdavid/dotfiles/tree/master/bin/git-peak https://git.sr.ht/~alexdavid/dotfiles/tree/master/bin/git-pe... It doesn't do any fancy tarball magic for Github links, but the shallow clone works fast enough for me - sub 3s on modestly sized repos (especially on non-github repos since github is fairly slow to clone/push/pull).
- eyelidlessness 6y agoI think it’s a big stretch to say that providing tools which interoperate with product A and not product B is pushing anyone toward anything. By that logic everything is coercive. This is like when I was informed that I was ruining free computing by personally preferring a less free desktop OS for my own usage and encouraging others to choose what they prefer. I’m glad you made something that works for more environments. But be careful, you may be accused of pushing more people to use git over mercurial.
- alexdme 6y agoGood points. For the record I wasn't trying to say that github1s is "ruining free computing", I was trying to convey the opposite. More diversity is good. If this had been published first, and github1s came along afterward to make it easier for users who don't set $EDITOR I'd be just as happy that it makes development more inclusive for all, not matter what the tools one prefers. I'd love to see a mercurial version as well :)
- eyelidlessness 6y agoGood points as well and I’m sorry if I was overly defensive. I agree totally that diversity is a good thing. I mistook some of your wording. But it’s clear you’re sincere about inclusion and I’m glad we had the opportunity to expand the conversation a bit! Thank you.
- 6y ago
- drzel 6y agoNice. I see Jarred had a similar idea to me after seeing github1s. For those with vim and without node: https://github.com/drzel/vim-repo-edit https://github.com/drzel/vim-repo-edit
- fireattack 6y agoDoesn't seem to work on Windows. Got "line 12: -S: command not found".
- Jarred 6y agoFixed in v1.1.26. Thanks for reporting
- vemv 6y agoI also count myself between those who implemented such a script when reading about github1s on HN :) My latest iteration involves not using the terminal at all - I open the project from emacs instead. So I `M-x peek-repo`, paste the url, and the project will be cloned and open right in my emacs (I use a GUI variant). Also, personally I don't find the need to use a tmpdir - my tradition is cloning to ~ and just let it remain there indefinitely. I always end up with a mere 100 repos before next time I wipe my computer for whatever reason.
- yoz-y 6y agoIt would be nice to give it a short lived cache. To avoid cloning a repo three times because I forgot something. Otherwise: good stuff, kudos!
- chiefalchemist 6y agoCan you update and commit? I ask because I've been looking to improve my Shopify workflow. Buddy.works does the deploy to Shopify. But I'm trying to cut out the push. More or less changes + saves become commits, and then instantly deploy. If not, perhaps someone can recommend something else?
- andrepd 6y ago>Clones the repo to a temp folder and opens editor Isn't this a 2-line shell script?