How to add /.vim directory and all of it's subdirectories to a git repository
# ignore everything * # don't ignore these files !*.vimrc !*.vim !*.bashrc !.gitignore
The problem is that
.vim is a directory and I want to include it (and all of its sub folders) in this git repository; however, they aren’t included with my current gitignore file.
- Starting vim-fugitive from command line
- Break from vimdiff on large number of diff files
- How does vundle treat breaking changes if uses configuration with links to git repositories?
- Is there a quick way to stage change hunks shown by vim-signify without entering a diff mode?
- Skip auto loading last session when Vim is launched from git commit
- Git gvim diff can't show difference
I’ve also tried this:
# ignore everything * # don't ignore these files !*.vimrc !*.vim/ !*.bashrc !.gitignore
# ignore everything * # don't ignore these files !*.vimrc !*.vim/* !*.bashrc !.gitignore
How can I ensure that the vim directory and its subdirectories are included in this git repository?
3 Solutions collect form web for “How to add /.vim directory and all of it's subdirectories to a git repository”
https://git-scm.com/docs/gitignore has this tip:
"/**"matches everything inside. For example, “abc/**” matches all files inside directory “abc”, relative to the location of the .gitignore file, with infinite depth.
You can always use the
-f flag to add it to git
Allow adding otherwise ignored files.
git add -f .vim
Assuming your version of git is later than 1.8.4 then the following should work in your gitignore file.
#ignore everything * #don't ignore these files !*/ !.vim/**
* pattern ignores everything including the parent directory and it is not possible to re-include anything if it’s parent directory is excluded.
!*/ re-includes all directories, allowing you to use the double-wildcard
!.vim/** to re-include everything under the .vim directory.
This has been tested to work under git version