Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

What is the correct way to make git ignore temporary files produced by vim in all directories (either globally across the system or locally for a single project)?

1 Answer

0 votes
by (50.2k points)

You can add vim files to .gitignore file because vim files end with ‘~

It can also create swap files that have the swp and swo extensions. To remove those you can use the lines:



Which helps you to ignore all temporary vim files from a project.

For ignoring  globally, you can create a .gitignore file in your home and use the following command:

git config --global core.excludesfile ~/.gitignore

Then you just need to add the files that you want to ignore. Thus, git ignore your temporary vim files.

Related questions

Browse Categories