...还修剪不再位于遥控器上的标签
git fetch
Git 2.17(2018 年第 2 季度)提供了一个方便的速记方法
摆脱本地持有的陈旧标签。
See commit 6317972 https://github.com/git/git/commit/6317972cff9b4df7a6cc666b08be7133ba81617c, commit 97716d2 https://github.com/git/git/commit/97716d217c1ea00adfc64e4f6bb85c1236d661ff, commit e249ce0 https://github.com/git/git/commit/e249ce0ccdb5c57f45a88daa25d24c5b602ee6e9, commit 627a129 https://github.com/git/git/commit/627a129b46530773369586f7982925fd41dc7227, commit d0e0747 https://github.com/git/git/commit/d0e07472faa938c83e9b1f76567f16614672668c, commit 2c72ed7 https://github.com/git/git/commit/2c72ed740f302bf51e6cd0824b8e7cbde1b1e8c2, commit e1790f9 https://github.com/git/git/commit/e1790f9245f120940be9333b09015e04a8e73127, commit 59caf52 https://github.com/git/git/commit/59caf52d094494a8c02dd7f15302891678533182, commit 82f34e0 https://github.com/git/git/commit/82f34e03e91af42a020f15a1d248bc75785c565a, commit 6fb23f5 https://github.com/git/git/commit/6fb23f56c16c0981a2f7b46f53ac3af12b247996, commit ca3065e https://github.com/git/git/commit/ca3065e7e7bcb406043f8202ef672f884eeb925d, commit bf16ab7 https://github.com/git/git/commit/bf16ab795574c27ffa0fe180cede2d355de41619, commit eca142d https://github.com/git/git/commit/eca142d30818bd9cfc0d3a6b38d6ae4dc4c500a0, commit 750d0da https://github.com/git/git/commit/750d0da9cfbc2519f1ef478d50de0ce549c41f05, commit 0711883 https://github.com/git/git/commit/0711883218039750f940d8febf05a81aa46d2ab9, commit ce3ab21 https://github.com/git/git/commit/ce3ab21b0c179559621fb7450a6f8c24e0a28ddb, commit aa59e0e https://github.com/git/git/commit/aa59e0eaf65b1e535248f67822053e3b2f5fcc26 (09 Feb 2018) by Ævar Arnfjörð Bjarmason (avar) https://github.com/avar.
(Merged by Junio C Hamano -- gitster -- https://github.com/gitster in commit c1a7902 https://github.com/git/git/commit/c1a7902f9adda4c3a64de99d565cf9982f12b1d9, 06 Mar 2018)
fetch: add a --prune-tags
选项和fetch.pruneTags
config
Add a --prune-tags
选项git-fetch
, 随着fetch.pruneTags
配置选项和一个-P
速记(-p
is --prune
).
这允许执行以下任何操作:
git fetch -p -P
git fetch --prune --prune-tags
git fetch -p -P origin
git fetch --prune --prune-tags origin
或者简单地:
git config fetch.prune true &&
git config fetch.pruneTags true &&
git fetch
而不是更冗长的:
git fetch --prune origin 'refs/tags/*:refs/tags/*' '+refs/heads/*:refs/remotes/origin/*'
在此功能之前支持拉动的用例是痛苦的
来自拥有两个分支的仓库and标签已删除
定期进行,并有我们当地的参考资料来反映上游。
在工作中,我们在存储库中为每次部署创建部署标签,并且
有lots其中,因此它们会在几周内存档
性能原因。
如果没有这个改变很难集中配置这样的存储库/etc/gitconfig
(在仅用于使用的服务器上
他们)。你需要设置fetch.prune=true
全局,然后对于每个
回购协议:
git -C {} config --replace-all remote.origin.fetch "refs/tags/*:refs/tags/*" "^\+*refs/tags/\*:refs/tags/\*$"
现在我可以简单地设置fetch.pruneTags=true
in /etc/gitconfig
还有,
和用户运行“git pull
" 会自动得到剪枝
我想要的语义。
2021 年 4 月更新,Git for Windows 2.30.1 和GitHub 桌面版 2.8 https://github.blog/2021-04-28-github-desktop-hiding-whitespace-expanding-diffs-repo-aliases/
如果你设置了它就可以工作prune
and pruneTags
选项:
cd C:\path\to\local\repo
git config fetch.prune true
git config fetch.pruneTags true
然后单击 GitHub Deskop 中的 Fetch origin:日志将显示:
2021-04-28T20:25:21.244Z - info: [ui] Executing fetch:
git -c credential.helper= -c protocol.version=2 fetch --progress --prune origin (took 2.986s)
...并且遥控器中不存在的任何本地标签都将消失!