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 6713195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:21:02+00:00 2026-05-26T08:21:02+00:00

I moved all my files into a folder ignored by git (an over-zealous .gitignore

  • 0

I moved all my files into a folder ignored by git (an over-zealous .gitignore). When I fixed the problem in .gitignore I had a set of deleted files and a set of new untracked files – even though most of the files are identical. How do I ask git to re-run its comparison algorithm to properly track changes in these files?

Summery of what I typed:

mkdir ./libs
git mv ./src-code ./libs/src-code #I might just have used mv
#a few changes
git status 
# nothing changed, huh?
# oh, I am ignoring all libs directories in .gitignore, 
#   I meant to only ignore the one at the root - fixed
git status
#   deleted:    ./src-code/...
# Untracked files:
#       ./libs/src-code
  • 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-05-26T08:21:03+00:00Added an answer on May 26, 2026 at 8:21 am

    git mv doesn’t actually anything you can’t do without it, because git doesn’t really have a concept of “a move” at most levels.† For the most part moves are represented in git as an added-file / deleted-file pair, which git may detect and treat as a move when displaying a diff or updating the working tree. [From your question, it looks like you already know this, but just for completeness…]

    One consequence of this is that it’s totally fine to use normal non-git mv (or any other tool) to move git-controlled files around; the results won’t be any different (and this can be handy if, for instance, you want to use some special tool to do the moves).

    However, as with any change to your working tree, git doesn’t really “know” about it until you’ve added the changed thing to the index with git add.

    So git mv A B is just a convenience command roughly equivalent to mv A B; git add -u A; git add B; since you already had done the mv, you could have just used git add in the same way to tell git about the new and deleted files. An easier way, if it’s ok for other changes in your working-tree to be put into the index, would just be git add -A, which adds both new files and changes in the working-tree (including deleted files) to the index.

    [That’s usually what I do: mv A B; …more changes…; git add -A; git commit…]

    ────────
    † This is different than many other source-control systems, which may have an explicit notion of moves that’s stored in commits, etc.

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

Sidebar

Related Questions

I have a bat script in which gets all files in a folder and
I am trying to copy all build output files and folders into a Bin
I have moved all of my files from being in the root (no folders,
So somebody on our team moved an entire folder into a subdirectory without using
I have an application that was in a folder named project, I moved all
I am trying to copy over some files pulled out from a zip folder,
How can I move all files except one? I am looking for something like:
We just did a move from storing all files locally to storing them on
Moved from preview 2 to preview 5 and now my Html.ActionLink calls are all
Recently our Web hosting provider moved to a medium trust level for all shared

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.