If your repo is starting to hoard build artifacts temporary logs or secret files you did not ask for then a .gitignore is your cleanup crew. This guide shows how to create edit and commit a .gitignore from the GitLab web UI so your repository stops tracking the stuff you never meant to track.
.gitignore keeps node_modules logs compiled assets and config files out of your commits. That keeps the history smaller and your CI less angry. It does not remove files that are already tracked though, so read the section on previously tracked files if you are cleaning up a mess.
Go to your project in the GitLab web UI and select the branch you want to update. No wizardry here just the right project and branch. If you are working with others consider creating a feature branch and opening a merge request for review.
Click New file or open the Web IDE then enter the filename .gitignore. The editor will create a file in the chosen branch. If you prefer the Web IDE you get a nicer editor and a built in preview for some file types.
Put patterns that match build artifacts temporary files and secret config. Use relative paths when you mean folders inside the repository. Example entries include
Pattern rules follow standard gitignore behavior so a trailing slash means a directory and an asterisk is a wildcard. Keep project specific patterns inside the repo and personal OS noise in a global ignore file.
Write a clear commit message. You can commit directly to the branch or create a new branch and open a merge request for review. The branch workflow helps avoid accidental overwrites and gives your teammates a chance to roll their eyes politely.
Run a local git status or check the repository file list in GitLab. Newly ignored patterns should not show up as untracked files. Remember that files already tracked by Git will stay tracked until you remove them from the index.
If large or sensitive files were already committed you need to remove them from the index and commit that change. For a single file run
git rm --cached path/to/file
Then commit and push. For many files you can script the removals or reset history with care and coordination.
Keep your laptop and OS related clutter out of the repo by using a global ignore file. Configure it once on your machine with
git config --global core.excludesfile ~/.gitignore_global
Then list things like .DS_Store and Thumbs.db there so every repo on that machine benefits.
Follow these steps and your repository will stop hoarding junk. Your future self will send you a polite thank you email or at least a grateful commit message.
I know how you can get Azure Certified, Google Cloud Certified and AWS Certified. It's a cool certification exam simulator site called certificationexams.pro. Check it out, and tell them Cameron sent ya!
This is a dedicated watch page for a single video.