gpt4 book ai didi

git - 旧的远程别名在 git 日志和 gitk 中仍然可见,如何删除?

转载 作者:太空狗 更新时间:2023-10-29 14:13:36 24 4
gpt4 key购买 nike

我最近将远程重命名为新别名,而旧别名(以及重命名之前的所有提交)在日志中仍然可见,因此在 gitk 中仍然可见。运行

$ git remote show old-alias 

显然返回:

fatal: 'old-alias' does not appear to be a git repository

这很烦人。如何彻底删除这些引用?手动删除可以吗

.git/logs/refs/remotes/old-alias/
.git/refs/remotes/old-alias/

目录?

编辑:

这是 git remote -v 的输出:

origin  git@github.com:my-user/our-repo (fetch)
origin git@github.com:my-user/our-repo (push)
upstream git@github.com:upstream-user/our-repo (fetch)
upstream git@github.com:upstream-user/our-repo (push)

这是 git log --oneline --graph --decorate 输出:

* 692d53f (HEAD, origin/somebranch, somebranch) Commit message                                                                                                                                 
* 9a4e794 Commit message
* 419376b Commit message
* 9a945bd (origin/someotherbranch, someotherbranch) Commit message
* 9a0fe3b Commit message
* 021d553 Commit message
* fa60dba Commit message
* 2d52d72 Commit message
* c59307f Commit message
* b89ae1c Commit message
* 063030c Commit message
* 97b8c77 Commit message
* ec65002 Commit message
* 38d7bb8 Commit message
* 36856fc Commit message
* 13b5065 Commit message
* 66e7dae (upstream/master, origin/master, old-alias/master, master) Commit message
|\
| * caf7e86 Commit message
| * a0c5abe Commit message
| * 9d1a735 Commit message
| * 4e7770d Commit message
| * cd3dd89 Commit message
* | 3037432 Merge pull request message
|\ \
| |/
| * 12b4a01 Commit message
| * be41159 Commit message
|/
* 8210859 Commit message
* 6b2090e Commit message
* 4b069f3 Commit message
* 1ef939c Merge pull request message
|\
| * fc559bb Commit message
|/
* 6fab424 Commit message
* ce10b38 Commit message
* 345128e Commit message

old-alias 已通过 git remote rename old-alias origin 围绕提交 2d52d72 更改为 origin

最佳答案

这里的问题有类似的问题:Why is old name of git remote sill in .git/refs/remotes? .按照那里的建议,我删除了

.git/logs/refs/remotes/old-alias/
.git/refs/remotes/old-alias/

手动目录。 .git/logs/HEAD.git/logs/refs/heads/someotherbranch 中有残留日志:

./logs/HEAD:14:6d8019... Ayberk Özgür <ayberk.ozgur@email.com> 1394819391 +0100   pull old-alias someotherbranch: Fast-forward
./logs/refs/heads/android:13:6d8019... Ayberk Özgür <ayberk.ozgur@email.com> 1394819391 +0100 pull old-alias someotherbranch: Fast-forward

我不确定这些是否是 old-alias 留下的唯一痕迹,或者它们是否有害。但是,到目前为止我还没有遇到任何问题。

关于git - 旧的远程别名在 git 日志和 gitk 中仍然可见,如何删除?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22805711/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com