Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8531539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:30:28+00:00 2026-06-11T09:30:28+00:00

I have a small scripting project that consists of five different source files in

  • 0

I have a small scripting project that consists of five different source files in one directory called “Droid XX-XX-XX”. Each time I created a new backup copy of the source directory, I put the date in the X’s. So there are about 15 different versions from different dates. I want to add each of these to my bare new Git repository starting from the earliest.

However I have run into several problems.

  1. One problem is that some of the files use tabs for indentation, while others use spaces — but Git treats a whole line as different even when the only difference is the tab vs. space issue. How can I make Git ignore indentation formatting?

  2. Another problem is that some filenames would have no spaces while others had spaces between the words — but Git treats them as different files. Worse, sometimes the filename was changed to something different (like “PatrolPlan” changed to just “Patrol”) for no real reason. When I’m adding a new set of files, how can I tell Git that even though the filename is different, it’s really just a new version of a certain older file? Or better yet, can I set it to auto-detect when this happens?

  3. The last problem is that at certain points during development, we merged two source files into one, or split one into two — but Git doesn’t automatically detect the similarities and deduce what happened. How can I tell Git what happened? Or better yet, how can I set it to auto-detect when two source files were combined or when one was split up?

I realize questions (2) and (3) are highly related. Thanks for any assistance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:30:30+00:00Added an answer on June 11, 2026 at 9:30 am

    It’s sounding like you need more control and standardization of the development process. The one who commits changes should be the same person who modifies the files. Or at least the committer should know exactly what changed.

    Examine carefully the output of git diff, and use the -w flag to ignore spaces. There’s also options to show differences within a line. See Diffs within a line below.

    Note that you won’t be able to tell git to skip the space changes when committing. I suggest using GitX (I prefer the “brotherbard” fork), which allows you to interactively discard hunks before committing.

    Use descriptive messages when committing. For example, if a file was split, say so. Make your commits small. If you find yourself writing long commit messages, break up the commit into smaller parts. That way when you examine the logs a long time later, it will make more sense what changed.

    Diffs within a line

    Git has some ability to show “word” differences in a single line. The simplest way is to just use git diff --color-words.

    However, I like customizing the meaning of a “word” using the diff.wordRegex config. I also like the plain word-diff format because it more clearly shows where the differences are (inserts brackets around the changes in addition to using color).

    Command:

    git diff --word-diff=plain
    

    along with this in my config:

    [diff]
            wordRegex = [[:alnum:]_]+|[^[:alnum:]_[:space:]]+
    

    This regex treats these as “words”:

    • consecutive strings of alphanumerics and underscores
    • consecutive strings of non-alphanumerics, non-underscores, and non-spaces (good for detecting operators)

    You must have a recent version of git to use wordRegex. See your git-config man page to see if the option is listed.

    UPDATE

    If you use git mv to rename a file (which is preferable to using another tool or the OS to rename), you can see git detecting the rename. I highly recommend committing a rename independently of any edits to the contents of the file. That’s because git doesn’t actually store the fact that you renamed – it uses a heuristic based on how much the file has changed to guess whether it was the same file. The less you change it during the rename-commit, the better.

    If you did change the file contents slightly, you can use -C param to git diff and git log to try harder to detect copies and renames. Add a percentage (e.g. -C75%) to make git more lenient about differences. The percent represents how similar the contents have to be to be considered a match.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small web app that generate PDF files as a report. I'm trying
I have a small project to record some form input on a page that's
I have small class called 'Call' and I need to store these calls into
I am making a small website as my first project. I have finalized to
We have an existing java-based heavyweight project that needed an interactive script interpreter. After
I have never done shell scripting before and need some help with a small
I have thousands of small CSV files I want to aggregate (with a little
I have a small scripting engine written which can run basic code. I want
I have a small custom scripting language, and I am trying to update it
I have been working with a small team on a small project about fiction

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.