Skip to main content

1️⃣2️⃣ Git Ignore & Git Large File Storage (LFS)

 

1️⃣2️⃣ Git Ignore & Git Large File Storage (LFS)


Git provides ways to ignore unnecessary files and handle large files efficiently, ensuring your repository remains clean and optimized.



🌍 Shape Your Future with AI & Infinite Knowledge...!!

🌐 Want to Generate Text-to-Voice, Images & Videos? 👉 http://www.ai.skyinfinitetech.com 📚 Read In-Depth Tech & Self-Improvement Blogs 👉 http://www.skyinfinitetech.com ▶ Watch Life-Changing Videos on YouTube 👉 https://www.youtube.com/@SkyInfinite-Learning 🔥 Transform Your Skills, Business & Productivity – Join Us Today! 🔥



🔹 .gitignore File – Ignoring Unwanted Files

Sometimes, there are files you don’t want to track in Git, such as:
✅ Temporary files (.log, .tmp, .swp)
✅ System-generated files (.DS_Store, Thumbs.db)
✅ Compiled code (.class, .o, .exe)
✅ Environment files (.env, node_modules, venv)

You can tell Git to ignore such files by creating a .gitignore file.

1️⃣ Creating a .gitignore File

To create a .gitignore file, simply run:


touch .gitignore

Then, open it and add the files or directories to ignore:


# Ignore system files .DS_Store Thumbs.db # Ignore logs and temp files *.log *.tmp # Ignore compiled files *.o *.class


To check which ignored files exist in your repo:


git status --ignored


To apply changes after modifying .gitignore:


git rm -r --cached . git add . git commit -m "Updated .gitignore"


🔹 Handling Large Files with Git LFS

By default, Git is not designed for large binary files (such as videos, images, or large datasets). Git Large File Storage (LFS) helps manage large files without bloating your repository.

1️⃣ Installing Git LFS

Install Git LFS using:


# For Windows choco install git-lfs # For Mac brew install git-lfs # For Linux curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash sudo apt install git-lfs

After installing, initialize Git LFS in your repository:

git lfs install


2️⃣ Tracking Large Files with Git LFS

To track specific file types (e.g., .psd, .mp4, .zip), use:


git lfs track "*.psd" git lfs track "*.mp4"

This creates a .gitattributes file, which Git uses to manage large files.

To check tracked files:


git lfs ls-files


3️⃣ Committing Large Files

Once tracked, commit the large files as usual:


git add .gitattributes git add largefile.mp4 git commit -m "Added large file with Git LFS" git push origin main


🔹 Benefits of Git LFS

Reduces repository size by storing only pointers to large files.
Speeds up Git operations by avoiding unnecessary file transfers.
Efficient for teams working with media, datasets, or binaries.



🔹 Best Practices

✔️ Always use .gitignore to keep your repository clean.
✔️ Use Git LFS only for large binary files.
✔️ Regularly check ignored files using git status --ignored.
✔️ Avoid tracking unnecessary files before committing.


By using .gitignore and Git LFS, you can keep your repository lightweight, clean, and efficient! 🚀





📚 Top 5 Books That Will Change Your Life!(Top 5 Life-Changing Books) 🚀


1️⃣ Atomic Habits – Build powerful habits and break bad ones!

👉 Get it here

2️⃣ The Psychology of Money – Master your financial mindset!

👉 Get it here

3️⃣ Think and Grow Rich – Unlock the secrets to wealth and success!

👉 Get it here

4️⃣ The Power of Your Subconscious Mind – Train your mind for success!

👉 Get it here

5️⃣ Rich Dad Poor Dad – Learn financial lessons the rich teach their kids!

👉 Get it here

Comments

Popular posts from this blog

Introduction to Terraform – The Future of Infrastructure as Code

  Introduction to Terraform – The Future of Infrastructure as Code In today’s fast-paced DevOps world, managing infrastructure manually is outdated . This is where Terraform comes in—a powerful Infrastructure as Code (IaC) tool that allows you to define, provision, and manage cloud infrastructure efficiently . Whether you're working with AWS, Azure, Google Cloud, or on-premises servers , Terraform provides a declarative, automation-first approach to infrastructure deployment. Shape Your Future with AI & Infinite Knowledge...!! Read In-Depth Tech & Self-Improvement Blogs http://www.skyinfinitetech.com Watch Life-Changing Videos on YouTube https://www.youtube.com/@SkyInfinite-Learning Transform Your Skills, Business & Productivity – Join Us Today! In today’s digital-first world, agility and automation are no longer optional—they’re essential. Companies across the globe are rapidly shifting their operations to the cloud to keep up with the pace of innovatio...

📊 Monitoring & Logging in Kubernetes – Tools like Prometheus, Grafana, and Fluentd

  Monitoring & Logging in Kubernetes – Tools like Prometheus, Grafana, and Fluentd Monitoring and logging are essential for maintaining a healthy and well-performing Kubernetes cluster. In this guide, we’ll cover why monitoring is important, key monitoring tools like Prometheus and Grafana, and logging tools like Fluentd to help you gain visibility into your cluster’s performance and logs. Shape Your Future with AI & Infinite Knowledge...!! Want to Generate Text-to-Voice, Images & Videos? http://www.ai.skyinfinitetech.com Read In-Depth Tech & Self-Improvement Blogs http://www.skyinfinitetech.com Watch Life-Changing Videos on YouTube https://www.youtube.com/@SkyInfinite-Learning Transform Your Skills, Business & Productivity – Join Us Today! 🚀 Introduction In today’s fast-paced cloud-native environment, Kubernetes has emerged as the de-facto container orchestration platform. But deploying and managing applications in Kubernetes is just half the ba...

🔒 Kubernetes Security – RBAC, Network Policies, and Secrets Management

  Kubernetes Security – RBAC, Network Policies, and Secrets Management Security is a critical aspect of managing Kubernetes clusters. In this guide, we'll cover essential security mechanisms like Role-Based Access Control (RBAC) , Network Policies , and Secrets Management to help you secure your Kubernetes environment effectively. Shape Your Future with AI & Infinite Knowledge...!! Want to Generate Text-to-Voice, Images & Videos? http://www.ai.skyinfinitetech.com Read In-Depth Tech & Self-Improvement Blogs http://www.skyinfinitetech.com Watch Life-Changing Videos on YouTube https://www.youtube.com/@SkyInfinite-Learning Transform Your Skills, Business & Productivity – Join Us Today! 🚀 Introduction: Why Kubernetes Security Is Non-Negotiable As Kubernetes becomes the backbone of modern cloud-native infrastructure, security is no longer optional—it’s mission-critical . With multiple moving parts like containers, pods, services, nodes, and more, Kuberne...