Skip to main content
ubuntuask.com

Back to all posts

How to Mark A File As Not Binary In Git?

Published on
3 min read
How to Mark A File As Not Binary In Git? image

Best Tools for Managing Git Files to Buy in December 2025

1 Learning Git: A Hands-On and Visual Guide to the Basics of Git

Learning Git: A Hands-On and Visual Guide to the Basics of Git

BUY & SAVE
$34.92 $45.99
Save 24%
Learning Git: A Hands-On and Visual Guide to the Basics of Git
2 Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1

Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1

  • COMPLETE DIY SET: INCLUDES ESSENTIAL TOOLS FOR EVERY HOUSEHOLD TASK.
  • POWERFUL 3.6V SCREWDRIVER: WITH LED AND EASY REVERSE MECHANISM.
  • BUY WITH PURPOSE: SUPPORTS BREAST CANCER RESEARCH WITH EVERY PURCHASE.
BUY & SAVE
$34.99
Apollo Tools 135 Piece Household Pink Hand Tools Set with Pivoting Dual-Angle 3.6 V Lithium-Ion Cordless Screwdriver - DT0773N1
3 FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag

FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag

  • COMPLETE TOOL KIT FOR ALL YOUR DIY NEEDS-EVERYTHING YOU NEED!
  • DURABLE FORGED STEEL PLIERS ENSURE STRENGTH FOR TOUGH JOBS.
  • STYLISH PINK DESIGN MAKES IT A GREAT GIFT OPTION FOR ANYONE!
BUY & SAVE
$59.99 $66.99
Save 10%
FASTPRO Pink Tool Set, 220-Piece Lady's Home Repairing Tool Kit with 12-Inch Wide Mouth Open Storage Tool Bag
4 CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink

CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink

  • ALL-IN-ONE TOOL SET FOR EASY DIY REPAIRS AND PROJECTS!
  • DURABLE, RUST-RESISTANT TOOLS ENSURE LONG-LASTING PERFORMANCE.
  • LIGHTWEIGHT AND PORTABLE DESIGN FOR ON-THE-GO CONVENIENCE!
BUY & SAVE
$22.99 $24.99
Save 8%
CARTMAN 39Piece Tool Set General Household Hand Tool Kit with Plastic Toolbox Storage Case Pink
5 Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development

Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development

BUY & SAVE
$43.23 $65.99
Save 34%
Version Control with Git: Powerful Tools and Techniques for Collaborative Software Development
6 Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black

Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black

  • COMPLETE TOOL KIT: ALL ESSENTIALS FOR DIY, REPAIRS, AND MAINTENANCE.

  • COMPACT STORAGE: DURABLE CARRYING CASE FITS IN ANY SPACE EFFORTLESSLY.

  • VERSATILE USE: PERFECT FOR HOME, OFFICE REPAIRS, AND EVERYDAY EMERGENCIES.

BUY & SAVE
$10.51
Stalwart - 75-HT1007 Household Hand Tools, Tool Set - 6 Piece by , Set Includes – Hammer, Screwdriver Set, Pliers (Tool Kit for the Home, Office, or Car) Black
7 Version Control with Git: Powerful tools and techniques for collaborative software development

Version Control with Git: Powerful tools and techniques for collaborative software development

  • AFFORDABLE PRICES ON QUALITY PRE-LOVED BOOKS FOR SAVVY READERS!
  • ENVIRONMENTALLY FRIENDLY CHOICE-REDUCE WASTE, READ MORE!
  • UNIQUE FINDS: DISCOVER RARE TITLES NOT AVAILABLE IN STORES!
BUY & SAVE
$40.00 $44.99
Save 11%
Version Control with Git: Powerful tools and techniques for collaborative software development
8 Professional Git

Professional Git

BUY & SAVE
$24.79 $52.00
Save 52%
Professional Git
9 Head First Git: A Learner's Guide to Understanding Git from the Inside Out

Head First Git: A Learner's Guide to Understanding Git from the Inside Out

BUY & SAVE
$50.99 $79.99
Save 36%
Head First Git: A Learner's Guide to Understanding Git from the Inside Out
10 Household Tool Box - 7-Piece Handheld Tool Kit With Hammer, Phillips Screwdrivers, Long-Nose Pliers, Tweezers, and Tape Measure by Stalwart

Household Tool Box - 7-Piece Handheld Tool Kit With Hammer, Phillips Screwdrivers, Long-Nose Pliers, Tweezers, and Tape Measure by Stalwart

  • ALL-IN-ONE TOOLKIT FOR DIY AND MINOR HOME REPAIRS AT YOUR FINGERTIPS.
  • COMPACT CARRYING CASE FITS EASILY IN ANY SPACE FOR CONVENIENT ACCESS.
  • ESSENTIAL TOOLS FOR A VARIETY OF TASKS-FROM REPAIRS TO ASSEMBLY NEEDS.
BUY & SAVE
$14.95
Household Tool Box - 7-Piece Handheld Tool Kit With Hammer, Phillips Screwdrivers, Long-Nose Pliers, Tweezers, and Tape Measure by Stalwart
+
ONE MORE?

To mark a file as not binary in git, you can set the file's content as text by using the command git add --renormalize <filename>. This command will update the index to be consistent with the latest ".gitattributes" file. The ".gitattributes" file allows you to specify how Git treats files based on their attributes, such as specifying that a file is text and not binary. By setting a file as not binary, Git will treat it as a regular text file and properly handle line endings and other text-related operations. This can be useful when working with files that should not be treated as binary, such as source code files.

How to change the binary attribute of a file in git?

To change the binary attribute of a file in Git, you can follow these steps:

  1. Find the file you want to change the binary attribute for in your Git repository.
  2. Use the following command to change the binary attribute for the file:

git add --renormalize <file_path>

This command tells Git to re-scan the file and update its attributes, including the binary attribute.

  1. Commit the changes to the file:

git commit -m "Change binary attribute of file"

  1. Push the changes to the remote repository if needed:

git push

After following these steps, the binary attribute of the file should be successfully changed in Git.

How to identify and mark a binary file as non-binary in git?

To mark a binary file as non-binary in git, you can use the following steps:

  1. Identify the binary files: Look for files with binary data such as images, videos, executables, etc.
  2. Mark the file as non-binary in the .gitattributes file: Open the .gitattributes file in the root directory of your git repository and add the file extension of the binary file followed by -binary to mark it as non-binary. For example, if you want to mark a .jpg file as non-binary, add the following line to the .gitattributes file: *.jpg -binary
  3. Add and commit the changes: After updating the .gitattributes file, add and commit the changes to make the file non-binary in git.

By following these steps, you can identify and mark a binary file as non-binary in git.

How to exclude a specific file from binary detection in git?

To exclude a specific file from binary detection in Git, you can use the .gitattributes file in your repository.

  1. Create a .gitattributes file in the root of your repository if it doesn't already exist.
  2. Add the path to the specific file you want to exclude from binary detection in the .gitattributes file. For example, if you want to exclude a file named example.jpg, you can add the following line to the .gitattributes file:

example.jpg -diff

This tells Git not to attempt binary detection on the specified file.

  1. Save the .gitattributes file and commit the changes to your repository.

Now Git will exclude the specific file from binary detection and treat it as a binary file without attempting to diff it.