跳转到内容

Spooky

远(仓库)在天边,近(操作)在眼前

Spooky 是原生的 macOS Git 客户端,
它能让服务器上的 Git 仓库用起来就像本地仓库一样顺手,还不用克隆!

免费开源 · macOS 26 或更高版本

跳过演示

spooky-test:driftwood

工作区(main – 9 个改动的文件)

spooky-test:

spooky-test: 已连接

mainorigin/main

Alex Chen
alex@example.com

  • M
  • ?
  • M
  • M
  • A
  • ?
  • M
  • M
  • ?
readings.ts

1 个块,新增 33 行,删除 6 行

@@ -2,40 +2,67 @@ export interface Reading {
22 stationId: string;
33 takenAt: Date;
44 temperature: number;
55 humidity: number | null;
66 pressure: number;
77 windSpeed: number;
88 windDirection: number;
gust?: number;
910 rainfall: number;
1011 uvIndex: number | null;
1112}
1213
1314function round(value: number, digits = 1): number {
1415 const factor = 10 ** digits;
1516 return Math.round(value * factor) / factor;
1617}
1718
1819export function parseReading(line: string): Reading {
const [stationId, takenAt, temperature, humidity, pressure, windSpeed, windDirection, rainfall = "0", uvIndex = ""] =
line.split(",");
const columns = line.split(",");
if (columns.length < 7) {
throw new ReadingError(line, `expected 7 columns, found ${columns.length}`);
}
const [stationId, takenAt, temperature, humidity, pressure, windSpeed, windDirection, rainfall = "0", uvIndex = "", gust = ""] =
columns;
2128
2229 return {
2330 stationId,
2431 takenAt: new Date(takenAt),
temperature: round(Number(temperature)),
temperature: round(numeric(line, "temperature", temperature)),
2633 humidity: humidity === "" ? null : round(Math.min(100, Math.max(0, Number(humidity)))),
pressure: round(Number(pressure)),
windSpeed: round(Number(windSpeed)),
windDirection: Number(windDirection),
pressure: round(numeric(line, "pressure", pressure)),
windSpeed: round(numeric(line, "wind speed", windSpeed)),
windDirection: numeric(line, "wind direction", windDirection),
gust: gust === "" ? undefined : numeric(line, "gust", gust),
3038 rainfall: round(Number(rainfall)),
3139 uvIndex: uvIndex === "" ? null : Number(uvIndex),
3240 };
3341}
3442
export class ReadingError extends Error {
constructor(
readonly line: string,
readonly problem: string,
) {
super(`Invalid reading (${problem}): ${line}`);
}
}
function numeric(line: string, column: string, raw: string): number {
const value = Number(raw);
if (raw.trim() === "" || Number.isNaN(value)) {
throw new ReadingError(line, `${column} is not a number`);
}
return value;
}
3562export function dewPoint(reading: Reading): number | null {
3663 if (reading.humidity === null) {
3764 return null;
3865 }
3966
4067 const a = 17.27;
4168 const b = 237.7;
1 个块,新增 33 行,删除 6 行上下文:
试试看

这是网页里的模拟窗口,数据都是示例。

服务器仓库

鬼魅般的超距作用

工作区留在服务器上,Git 也在那里执行;你在 Mac 上的 Spooky 窗口里操作它。

你的 Mac

  • Spooky 的窗口
  • ~/.ssh/config 与 SSH 密钥

你的服务器

  • 工作区与 Git
  • ~/.spooky/bin/ 里的小脚本

服务器仓库怎样工作

不用克隆到本机

工作区留在服务器上,不用先克隆到本机。

Git 在服务器上执行

Spooky 用服务器上的 Git,文件经 SFTP 读写。

用你现有的 SSH

连接用系统自带的 SSH 和 ~/.ssh/config 里的主机别名,认证、主机指纹与连接复用都交给 OpenSSH。

不要 root,不装常驻服务

服务器上不需要 root,也不装常驻服务;Spooky 只在 ~/.spooky/bin/ 放一个小脚本。

一个主机别名,一个路径

选 添加服务器仓库…,填上 ~/.ssh/config 里的主机别名,再输入或浏览到服务器上仓库的路径。

Spooky 检查连接之后打开仓库。

添加服务器仓库的对话框,填好了主机别名 spooky-test 与路径 /srv/git/driftwood。添加服务器仓库的对话框,填好了主机别名 spooky-test 与路径 /srv/git/driftwood。

完整的 Git 工作流

从第一处改动,到合并分支

暂存、提交、看历史、同步、解决冲突,仓库在本机还是在服务器上,做法都一样。

分支、同步、合并与变基

在工具栏上获取、拉取、推送。

把分支拖到当前分支上就是合并,拖的时候按住 ⌥ 就是变基。

侧边栏的分支一节。侧边栏的分支一节。
推送对话框:把 main 推到 origin/main。推送对话框:把 main 推到 origin/main。

冲突向导

每个冲突的文件,Spooky 都把两边的版本摆出来。

选一个,就用它解决;两个都选,就交给合并工具。

合并之后的冲突向导,摆出 src/units.ts 两边的版本。合并之后的冲突向导,摆出 src/units.ts 两边的版本。

历史与搜索

在提交图里看每条分支的走向,按提交信息、作者、提交者、文件、提交哈希或日期搜索。

撤销与重做

提交、反转、储藏等操作,按 ⌘Z 撤销,按 ⇧⌘Z 重做。

Pull Request 与 Merge Request

在 GitHub、GitLab.com 与私有部署的 GitLab 上列出、创建、讨论、检出、合并和关闭。

Stash、Submodule、Worktree 与 Git LFS

服务器仓库里也都能用。

仓库在哪儿,Spooky 就在哪儿。

需要 macOS 26 或更高版本,本机与服务器上的 Git 需要 2.41 或更高版本。详见 系统要求。