his is one of the easiest best practices, which you can start using in less than 2 minutes. But the impact will be huge.

Today I will share one of my all-time favorite practice - DIG in your GIT

And I have a bonus section for you, I am sharing two downloadable pdf with 51+ important git commands with a one-line summary and 35+ git best practices with you in this post.

Don’t Ignore .gitignore (DIG) in your Git repository. I have noticed in the past many developers do not use a .gitignore file.

Use the .gitignore file is one of the git best practices. And I will cover in this post how gitignore can boost your code quality with other advantages.

Also, I will explain how you can use your global .gitignore file (without adding or pushing). And this comprehensive file will be used by all your repository.

So let’s dive in…

What Is .gitignore?

There is not any git ignore command which you can use directly to ignore the unwanted files in your repository; instead, you should use .gitignore file.

In simple words, the .gitignore file is a text file that tells Git about which files to ignore.

Git checks three things in your working copy.

  1. Untracked — Your changes that have not been staged or committed.
  2. Tracked — Your all changes that have been previously staged or committed.
  3. Ignored — All files which you told to Git to ignore.

It’s easy to create .gitignore file, create a text file, and name it .gitignore (that’s it)

Remember to add a single dot . at the beginning of this file name.

How Many Types of .gitignore Files?

I have seen many developers use the local .gitignore file. They add the gitignore file in their project repository. But very few use the global file. In this section, I will explain both.

There are two types of .gitignore files.

  1. Local .gitignore file
  2. Global .gitignore file

Local .gitignore

If you add the.gitignore file in the root of your git repository, it will be considered as a local file. It means that the .gitignore file will work on that repository. And .gitignore file should be committed to your repository.

#devops #git #git ignore command #gitignore #gitignore files

DIG in Your GIT — Best Practices
1.35 GEEK