Know what to ignore
There are several types of files that you should typically ignore in a Git repository using a .gitignore
file. Ignoring these files will keep your repository clean and prevent unnecessary files from being committed.
Build artifacts. Don't commit build artifacts to your repository—they can be regenerated from the source code and will only bloat the repo. They may also change slightly each time (e.g., timestamps), making version control messy.
- If the artifacts are final deliverables (e.g., static website files for deployment).
- If seeing changes in built files between releases is useful.
- If the build process is slow or resource-heavy, committing them can save time.
Project dependencies. Don't commit dependencies—they can be installed via a package manager and will only bloat your repo. Frequent updates also make version control messy. Instead, commit lock or manifest files to track exact versions.
- Committing dependencies can improve build speeds, because dependencies don't have to be downloaded each time. This may become relevant if your project has auto-testing capability.
- Committing dependencies ensures the project builds with exact versions and prevents supply chain attacks. Think of a hacker from North Korea who breaks the global package registry and you unsuspectingly install the infected package. It's a real-life story that has happened several times already.
API keys and other secrets. You may have a configuration file with API keys, passwords, or other secrets. You don't want to commit these files to your repository because they contain sensitive information. Besides, you may want to use different keys in different environments (development, testing, production).
Logs and temp files. Your project may generate log files, temporary files, or other files that are not part of the source code. These files are not useful for your project, and you don't want to commit them to your repository.
Large binary files. Large files (e.g., images, videos, archives) of size over 100 MB are not suitable for version control. Git is not designed to handle large files efficiently, and it can slow down your repository. Use Git LFS or other tools to manage large files. You can still commit large files, but it'll just slow everything down in the long run.
IDE and editor files. Modern editors and IDEs create hidden directories with their settings and cache files. These files are generally not useful for your project, because they contain your own preferences and settings. However, you may want to commit them to your repository if your team wants to share the same settings.
System files. In macOS, the operating system may randomly create service files called .DS_Store
in your project directory. These files are normally hidden in the Finder, but they are visible in the terminal. These files are not useful for your project, and you don't want to commit them to your repository.
Hi! I'm Alex, creator of GitByBit.
And this is Gitopedia—a reference that summarizes knowledge in my Git course.
Gitopedia is designed to be a personal knowledge base. When you progress through the main Git course in VS Code, you unlock all of these topics, one by one, bit by bit. This gives you time to digest the information and gradually build the mental model of Git. Here's an example of how it works:
Learning directly in VS Code lets you practice Git exactly as you would in real life, doing real jobs, writing real code. In addition, the course has access to your actual terminal, so it can point out mistakes, suggest workarounds, etc.
The course is FREE, there are no Ads or other bullshit. There are optional premium add-ons you can purchase, mainly to support my work (regrettably, I have to eat every day), but that's totally up to you.