knowledgecenter-breadcrum

Knowledge Center

03 Sep, 2024

Optimizing Code Check-ins: Ignoring Unnecessary Files for a Cleaner Azure DevOps Repo.

Posted on 03 Sep, 2024 by Ankit Gore, Posted in Azure DevOps Services

Blogs

Introduction

In this blog, we will learn about the code check-in process in DevOps. After development, unnecessary files are sometimes accidentally checked in, which increases the size of the repository. Each time you check in, these files will accompany your changes, making the code look messy during reviews and potentially causing conflicts when committing. To avoid these issues, we will follow a one-time process to maintain a clean repository.

Prerequisites

  1. Basic Knowledge of Git.
  2. Access to Repository.
  3. Visual studio.

 

Step-by-Step Guide to Maintain a Clean Repository by Excluding Unnecessary Files.

Step 1: Identify Unnecessary Files.

Identify files and directories that should not be included in the repository, such as:

  • Debug files
  • Build files
  • .vs directories


Step 2: Delete the contain inside the Release & Debug.

We have release and debug folder in bin and obj folder delete the files inside that.

Same for .vs file. now push your code once.


Step 3: Create or Update the .gitignore File.

The .gitignore file specifies which files and directories Git should ignore. If a .gitignore file doesn't already exist in your repository, create one in the root directory.

Add the following two lines to the .gitignore file:

# Ignore Visual Studio files
.vs/

# Ignore build and debug files
Debug/

Release/

And push the changes.


Before the changes:



After the Changes:


You can see the difference now—only the files with changes you have made are being checked in.

Conclusion

Keeping your repository clean by excluding unnecessary files, such as debug, build, and .vs files, is essential for efficient development and deployment. By setting up a proper .gitignore file and following the steps outlined in this guide, you can prevent repository clutter, avoid conflicts, and ensure smoother code reviews. This simple, one-time process helps maintain an organized and efficient codebase, ultimately enhancing your DevOps workflow.

Comment

This is a Required Field

Loading

Recent Updates

Thumbnail Image of ROI
Blogs
17 Jun, 2025

Maximizing ROI with Power Apps: The Role of Expert Consulting Services

Maximizing ROI with Power Apps: The Role of Expert Consulting Services Explore how skilled professionals can get you the best…

READ MORE
Digital transformation thumbnail
Blogs
12 Jun, 2025

How Microsoft 365 Consulting Can Drive Digital Transformation for Your Organization

How Microsoft 365 Consulting Can Drive Digital Transformation for Your Organization Digital transformation boasts way more than just shifting from…

READ MORE
Blogs
12 May, 2025

How to create an Autonomous Agent in Copilot Studio

What Are Autonomous Agents in Copilot Studio? Autonomous agents are AI-driven entities that operate independently within Copilot Studio. They go…

READ MORE