sudo cast
48 subscribers
498 photos
12 videos
16 files
1.54K links
v2 @sudo_recast

casted something nice or not

v1 / cast / channel / telegram / sudo

more @sudo_radio
email telegram@gadflysu.com
Download Telegram
优秀的 Git GUI 软件 #SmartGit(允许非商业使用)
https://www.syntevo.com/smartgit/

#awesome #software #git
查找 #GitHub 仓库的复刻 (fork)

1. 官方网络图,如 Network Graph · coreutils/coreutils
3. 搜索中使用 fork:true 或 fork:only(文档)
2. Active GitHub Forks
3. GitPop2

#git
To revert a patch:

git apply -R <patch>
git apply --reverse <patch>


#til #git
当远程 #git 仓库过于庞大,本地按需选择有限的分支来工作。在克隆时选择单一分支:

git clone --branch=master --single-branch git@server:repo.git

添加另一个远程分支并配置追踪:

git remote set-branches --add origin another_branch
git fetch
git checkout another_branch
#GitHub 作为一种分发渠道的意义更重。一些闭源软件在上面发布预编译版本。一些软件没有打包,提供一个安装脚本让用户克隆本仓库,依靠 #git 保证完整性,定时更新。
To track but not stage files:

git add [--intent-to-add | -N] [--] [<pathspec>...]

Record only the fact that the path will be added later.

#git #til
一个不知道 commit message(见下)第二行留空的人好意思说我哪里哪里分号没对齐逼死强迫症。👍

1. something
2. something
3. ...


#办公室见闻 #git
有没有比较优雅的同时在本地和服务器切换分支的方法?(编译需在服务器上。)

#git
教训:今天 #git msg 把 refactor 写成 fix 了。(是昨天
Don’t cherry-pick to cause a mess of submission. Please reset refs. You can even use “rebase” to fast-forward. Avoid creating redundancy objects. Read manual/docs before entering commands. :)

既不愿 branch 也不愿 merge 那就干脆不要用 git 了。

#git #办公室见闻
warning: refname 'the_branch' is ambiguous.

网上查到的结果通常都是说存在近似同名 ref(标签或分支,在 .git/refs 目录下),通过 git show-ref 可以查到。我的情况比较特殊(和 Magnus 一样),原因在于错误地执行了:

git update-ref the_branch <newvalue>

其结果是在 .git 目录下生成 the_branch 路径,这很难找到。正确的命令是:

git update-ref refs/heads/the_branch <newvalue>

我原来是打算在不切换分支的前提下设置其他分支引用,事实证明看 Stack Overflow 还是要多往下翻,正确的做法是:

git branch -f <branchname> [<start-point>]

#git
#Git 灾难一例

❯ git diff --ignore-space-change source.c > source.patch

❯ git checkout -- source.c

❯ git apply source.patch
error: patch failed: source.c:1807
error: source.c: patch does not apply
配置有多个远程仓库的 #git 仓库,无法直接通过 git checkout branch-name 来创建本地分支,原因是 git 不知道从哪个分支来创建。正确的做法不是:

git checkout -b branch-name origin/branch-name

而是:

git checkout --track origin/branch-name
.git/refs 里找不到的引用就在 .git/packed-refs 里。

#git