sudo cast
47 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
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