git peek
is the fastest way to open a remote git repository in your local text editor.
Use it when you want to browse or search other people's code with your own editor.
Homebrew:
brew install jarred-sumner/git-peek/git-peek
For Windows and Linux, install from npm directly:
npm install -g @jarred/git-peek
1-click "Peek" button for GitHub:
git peek https://github.com/ylukem/pin-go
git peek https://github.com/jarred-sumner/atbuild
git peek https://github.com/facebook/react/pull/20790
git peek hanford/trends
git peek react
git peek https://github.com/jarred-sumner/fastbench.dev/tree/main/
git peek https://github.com/evanw/esbuild/blob/master/lib/common.ts
Pass git peek
a git repository or a github link, and it will quickly fetch and open it in your local editor. It stores the repository in a temporary directory and deletes it when you close the editor or git peek
.
It's fast.
❯ git peek https://github.com/nodejs/node/blob/master/lib/dgram.js
⏳ Extracting repository to temp folder...
�� Launched editor in 0.20s
If you paste a link to a pull request on GitHub, it will open it quickly:
❯ git peek https://github.com/facebook/react/pull/20790
�� Launched editor in 0.13s
⏳ Extracting repository to temp folder...
�� Finished downloading repository!
Much faster than cloning.
If you don't pass git peek
input, it will let you search Github repositories and show trending repositories:
❯ git peek
Search Github repositories:
> Search
❯ iam-abbas/Reddit-Stock-T | Fetch currently trending stocks on Reddit
codeSTACKr/free-develope | Free Developer Resources
justjavac/1s | 天若有情天亦老,我为网站加一秒
PaddlePaddle/PaddleNLP | NLP Core Library and Model Zoo based on PaddlePa
ModernPwner/cicuta_viros |
jevakallio/vscode-live-f | Run your web app inside VS Code
getActivity/AndroidCodeS | Android 代码规范文档
gigantz/react-xpress | React renderer to build Node.js server
If you type a repository name without the owner (react
instead of facebook/react
), it will search:
❯ git peek react
Search Github repositories:
> react
❯ facebook/react | A declarative, efficient, and flexible JavaScrip
typescript-cheatsheets/r | Cheatsheets for experienced React developers get
duxianwei520/react | React+webpack+redux+ant design+axios+less全家桶后台管
discountry/react | React docs in Chinese | React 中文文档翻译
Cathy0807/react | 京东首页构建
react-redux-antd-es6/rea | 基于react的企业后台管理开发框架
HackYourFuture/React | This repository contains all the material for th
geist-org/react | Modern and minimalist React UI library.
If you paste a link to a file on GitHub, it will quickly open the file in your local editor:
❯ git peek https://github.com/Jarred-Sumner/git-peek/blob/main/src/index.ts
�� Launched editor in 0.39s
⏳ Extracting repository to temp folder...
�� Finished downloading repository!
❯ git peek -h
Quickly preview remote Git repositories in your local editor
USAGE
$ git-peek [git link or github link or search query or repository file path]
EXAMPLES
git peek https://github.com/evanw/esbuild/blob/master/lib/common.ts
git peek https://github.com/ylukem/pin-go
git peek https://github.com/jarred-sumner/atbuild
git peek hanford/trends
git peek react
OPTIONS
-e, --editor=editor [default: auto] editor to open with, possible values:
auto, code, subl, nvim, vim, vi, code-insiders.
By default, it will search $EDITOR. If not found, it
will try code, then subl, then vim.
-r, --register [default: false] Register the git-peek:// url protocol
This allows the "Open" buttons to work on
github.com once you\'ve installed the extension. Only
supported on macOS and Windows
-o, --out= [default: system temp directory] output directory to
store repository files in. If youre cloning a large
repo and your tempdir is an in-memory storage (/tmp),
maybe change this.
-w, --wait [default: false] wait to open the editor until the
repository finishes downloading. always on for vi.
--no-keep [default: false] keep the repository, rather than
deleting it.
-b, --branch [default: "master"] select a branch/ref to use.
if the repository doesn't use master/main,
you'll want to set this manually. but it will
try to infer from the input by default.
-d [default: false] Ask the GitHub API
for the default_branch to clone.
-h, --help show CLI help
ENVIRONMENT VARIABLES:
$EDITOR: code --wait
$GITHUB_TOKEN: ********
.env: ✅ $HOME/.git-peek
For use with private GitHub repositories, set $GITHUB_TOKEN to a personal
access token. To persist it, store it in your shell config or the .env shown above.
To use git-peek
with private repositories, set a $GITHUB_TOKEN
to a personal access token. If you don't want a global shell $GITHUB_TOKEN
, you can set in $HOME/.git-peek
.
Its a .env
file, so the syntax looks like this:
EDITOR="code"
GITHUB_TOKEN="**********"
You can also save a custom editor this way. So you don't have to add -e vim
everytime if $EDITOR
is not propagating to the process.
If you pass it a GitHub repository, it fetches a tarball instead of using git and decompresses it while downloading it (streaming). From unscientific benchmarks, this is about 2x faster than cloning. While downloading & decompressing the tarball, it also downloads the specific file linked to (or the README.md
) via JSDelivr's CDN. Whichever happens first, it opens in the editor (usually JSDelivr), but it will keep fetching the repo until its complete or the program exits.
If you pass it a git repository rather than a Github url, it does a partial clone instead of doing a full clone.
When your editor closes or you close git peek
, it deletes the repository from your computer.
1.3.18
1.3.14 - 1.3.17
1.3.14
nvim
/n?vim?/
support for Peek (browser extension) on macoS.1.3.8 - 1.3.13
git peek -r
on macOS1.3.7
1.3.6
1.3.5
1.3.4
rimraf
to first delete all the files inside the folder and then delete the folder itself. This probably isnt' ideal for performance, maybe there's a more "native" system call for this.VERBOSE
env var setsubl.exe
from showing up1.3.3
git-peek://
(this already worked in the CLI). git-peek
should now automatically delete the repository when using the browser extension (when your editor is Visual Studio Code)1.3.0 - 1.3.2
git-peek://
protocol!! (related: https://github.com/Jarred-Sumner/register-url-windows). This enables 1-click open buttons on GitHub. Run git peek --register
./bin/git-peek-win32.exe
that runs git-peek
without the CMD.exe window appearing (source code is in the win32
folder). It just receives git-peek://
URLs, so if you run it by itself, nothing will show up and you'll be kind of confused.git-peek --register
. So that it runs faster.git-peek --register
if you haven't already.repository@branchOrRef
name e.g. esbuild@main
, so its clearer what you're looking at in your editor. Its still a long string, but the beginning at least makes more sense now.peekautodelete
. This will later be used for a git-peek purge
command that will automatically delete any folders it finds in the temp directory containing "peekautodelete"
incase anything was missed.--wait
CLI argument does not support folders, so it's pretty tough to detect when the user closes Sublime Text without some kind of process monitoring.1.2.2
: Prevent process from sticking around longer than necessary if its still extracting the repository when its supposed to close. Add fs.rmSync
polyfill
1.2.1
: Slightly improve reliability & performance of launching the editor (using child_process.spawn instead of using child_process.exec) and allow the AppleScript to launch multiple instances
1.2.0
: Create a git-peek://
URL handler, so that you can click a link to open a repository in your local editor. Register the URL handler with git peek -r
.
1.1.37
: Add easter egg to search results
1.1.36
: Add optional -d
flag that automatically asks github what the default branch is before cloning instead of guessing its either main
or master
.
1.1.35
: Add optional --branch
flag so you can choose which branch to clone if its not shown in the url. See #17
1.1.34
: Fix home directory path resolution on Windows
1.1.33
: Add precompiled binary for windows in releases script.
1.1.32
Add --no-keep
flag which skips deleting repositories on exit. Fix support for unknown editors. When the editor is unknown, it asks to confirm deleting the repository.
1.1.31
: Fix issue where when vim
is loaded with a specific file (rather than the repository root dir), it would log text on top of vim
.
1.1.30
git-peek now starts 32% faster (delayed loading ink
until its used for search)
You can now store $EDITOR
and $GITHUB_TOKEN
in $HOME/.git-peek
. Its a .env
file, so the syntax looks like this:
EDITOR="code"
GITHUB_TOKEN="**********"
Removed using the $GITHUB_TOKEN
from ~/.hubs/config
.
1.1.28-29
: Fix for Node 12+ #141.1.27
: Added --wait
flag which waits to open the editor until the entire repository is downloaded. Added --out
flag which changes the temp directory to store files in (see #8)1.1.22-26
: Fix windows bug.1.1.21
: Add Pull Request support. Now you can use this to quickly read a pull request. For example: git peek https://github.com/facebook/react/pull/20790
.1.1.20
: Fix bug when using with Fedora1.1.16-1.1.19
: trying to get release-it
to work1.1.15
: Move code-insiders
to end of preference list1.1.14
: Fix code-insiders and fix passing in editor manually when its subl
or code
.1.1.13
: Use Authorization
header instead of access_token
query string.1.1.12
: When available, also use github access token for fetching tarballs (instead of just search)1.1.11
: When available, use github access token for github API requests to enable private repositories to work. To enable this, either set a GITHUB_TOKEN
environment variable or if you've installed hub, it will automatically use oauth_token
from $HOME/.config/hub
. In other words, if you use hub
, this should just work by default.1.1.10
: Fix vim1.1.9
: Fix Windowssubl --wait
does not support folders, so git-peek is unable to detect when Sublime Text closes. On the CLI, this isn't a problem – it just shows a "Delete Repository Y/n" confirm message, same as other editors.
On the browser extension, I'm not really sure yet what to do about this.
Visual Studio Code doesn't have this problem because passing a directory to --wait
correctly waits until the window is closed.
Originally inspired by github1s.com.
Git-Stash 官方描述: git-stash - 将更改隐藏在脏工作目录中 使用git stash时要录制工作目录和索引的当前状态,但想回到干净的工作目录。该命令保存您的本地修改并恢复工作目录以匹配HEAD提交。 此命令隐藏的修改可以用 列出,用 git stash list进行检查git stash show,并用 恢复(可能在不同的提交之上)git stash apply。git sta
一、 Git 常用命令速查 Git常用指令 git branch 查看本地所有分支 git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支 git branch -r 查看远程所有分支 git commit -am "init" 提交并且加注释 git remote add origin git@192.168.1.119:ndshow g
一、 Git 常用命令速查 git branch 查看本地所有分支 git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支 git branch -r 查看远程所有分支 git commit -am “init” 提交并且加注释 git remote add origin git@192.168.1.119:ndshow git push ori
问题描述 git 错误: Unable to find remote helper for 'https' 今天知道问题的原因了,是因为 /usr/libexec/git-core/ 路径没在 PATH 环境变量中。 我们查看一下: $ ls /usr/libexec/git-core/ git git-http-backend git-receive-pack git-add git-htt
emacs .emacs Apache Ivy 2.2.0的第一个候选版本 Apache Ivy团队宣布了2.2.0 RC1版本 。 这是Ivy 2.2.0的第一个候选版本。 Ivy是用于管理项目依赖项的工具。 此版本引入了一种新的Ivy文件父机制,并支持ivy.xml父机制以及'gzip'和'deflate'HTTP内容编码。 还有一个错误修复列表。 SwingX 1.6.1发布 SwingX已
一、 Git 常用命令速查 git branch 查看本地所有分支 git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支 git branch -r 查看远程所有分支 git commit -am “init” 提交并且加注释 git remote add origin git@192.168.1.119:ndshow git push ori
Git操作指令 一.常用 git branch 查看本地所有分支 git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支 git branch -r 查看远程所有分支 git commit -am “init” 提交并且加注释 git remote add origin git@192.168.1.119:ndshow git push orig
一、 Git 常用命令速查 git branch 查看本地所有分支 git status 查看当前状态 git commit 提交 git branch -a 查看所有的分支 git branch -r 查看远程所有分支 git commit -am "init" 提交并且加注释 git remote add origin git@192.168.1.119:ndshow git push ori
git(1) Manual Page NAME git - the stupid content tracker SYNOPSIS git [--version] [--help] [-c =] [--exec-path[=]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-
Git常用命令 master: 默认开发分支 origin:默认远程本本库 Head:默认开发分支 Head^:Head的父提交 创建版本库 git clone <url> #克隆远程版本库 git init #初始化本地版本库 修改和提交 git status #查看状态 git diff #查看变更内容 git add #跟踪所有改动过的文件 git add <file> #跟踪指定文件 gi
创建一个新文件 ~/.gitignore ,并将以下内容添加进去,这样全部 git 仓库将会忽略以下内容所提及的文件。 # Folder view configuration files .DS_Store Desktop.ini # Thumbnail cache files ._* Thumbs.db # Files that might appear on external disks .S
功能分支(feature branches)、发布分支(release branches)、主干(master)、开发分支(develop)、紧急修复分支(hotfixes)和标签(tag)。 Git Flow 太复杂 Git Flow 违背了分支的“短命”原则:在使用 Git 时,在同一个分支上开发代码的人越多,出现合并冲突的几率就越高。在使用 Git Flow 后,冲突几率会变得更高,因为还有
规范建设 commit message格式 <type>(<scope>): <subject> type(必须) 用于说明git commit的类别,只允许使用下面的标识。 feat:新功能(feature)。 fix/to:修复bug,可以是QA发现的BUG,也可以是研发自己发现的BUG。 fix:产生diff并自动修复此问题。适合于一次提交直接修复问题 to:只产生diff不自动修复此问题
集中式与分布式 中心服务器 工作流 分支实现 冲突 Fast forward 储藏(Stashing) SSH 传输设置 .gitignore 文件 Git 命令一览 参考资料 集中式与分布式 Git 属于分布式版本控制系统,而 SVN 属于集中式。 集中式版本控制只有中心服务器拥有一份代码,而分布式版本控制每个人的电脑上就有一份完整的代码。 集中式版本控制有安全性问题,当中心服务器挂了所有人都没
作为一名开发者怎么可能没有 Git 呢? 我们马上就来安装: $ brew install git 好的,现在我们来测试一下 git 是否安装完好: $ git --version 运行 $ which git 将会输出 /usr/local/bin/git. 接着,我们将定义你的 Git 帐号(与你在 GitHub 使用的用户名和邮箱一致) $ git config --global user.
Name git - 迟钝的内容跟踪器 概要 git [--version] [--help] [-C <path>] [-c <name>=<value>] [--exec-path[=<path>]] [--html-path] [--man-path] [--info-path] [-p|--paginate|--no-pager] [--no-replace-objects]
Overview 始终没有很好的掌握Git, 这又是Stage又是Stack的,每次冲突都要找同事来帮忙解决。 Tools 貌似SmartGit最美观最好用,但License始终是个问题,只有非商业软件才能免费用。 SourceTree最大问题是不能按目录来查看文件和Log。 Commands remove tag remotelly git tag -d V4.0.0.GA git push o
Git 可以为项目做版本控制项目。 先搜索一下: yum search git 我看到一些 git2u 这个前缀的包,这应该是 ius 仓库提供的。 安装 Git: sudo yum install git2u -y 如果出现冲突的提示,是因为你的系统里已经包含了 Git,需要先删除掉系统里的 Git 才能继续安装。 再做一点简单的配置,告诉 Git 我们是谁: git config --g