gpt4 book ai didi

git - 如何将/.vim 目录及其所有子目录添加到 git 存储库

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

这是我的 ~/.gitignore 文件:

# ignore everything
*
# don't ignore these files
!*.vimrc
!*.vim
!*.bashrc
!.gitignore

问题是 .vim 是一个目录,我想将它(及其所有子文件夹)包含在这个 git 存储库中;但是,它们不包含在我当前的 gitignore 文件中。

我也试过这个:

# ignore everything
*
# don't ignore these files
!*.vimrc
!*.vim/
!*.bashrc
!.gitignore

还有这个:

# ignore everything
*
# don't ignore these files
!*.vimrc
!*.vim/*
!*.bashrc
!.gitignore

如何确保 vim 目录及其子目录包含在这个 git 存储库中?

最佳答案

尝试 !.vim/!.vim/**

https://git-scm.com/docs/gitignore有这个提示:

A trailing "/**" matches everything inside. For example, "abc/**" matches all files inside directory "abc", relative to the location of the .gitignore file, with infinite depth.

关于git - 如何将/.vim 目录及其所有子目录添加到 git 存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35260505/

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