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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:04:26+00:00 2026-06-02T00:04:26+00:00

I moved a file using git mv . Now I would like to do

  • 0

I moved a file using git mv. Now I would like to do a diff on the new file to compare it with the old file (with the old, now non-existent name).

How do I do this?

  • 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-02T00:04:27+00:00Added an answer on June 2, 2026 at 12:04 am

    You need to use -M to let git autodetect the moved file when diffing. Using just git diff as knittl mentioned does not work for me.

    So simply: git diff -M should do it.

    The documentation for this switch is:

    -M[<n>], --find-renames[=<n>]
           Detect renames. If n is specified, it is a threshold on the similarity index 
           (i.e. amount of addition/deletions compared to the file’s size). For example, 
           -M90% means git should consider a delete/add pair to be a rename if more than
           90% of the file hasn’t changed.
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I moved a VS Solution file from an old PC to a new PC.
After I have moved a file in git (using git mv ), looking at
I'm using TortoiseSVN against the SourceForge SVN repository. I'd like to move a file
I've moved a file manually and then I've modified it. According to Git, it
I keep getting this error, although the file still gets moved into the correct
I would like to move a file or folder from one place to another
When I move a file in git using git-mv the status shows that the
Git newbie here. Using Xcode 4.3.2. Had to move my project file directory. Commit
My problem is this: I'm using a WatchService to get notified about new files
I want to move some file to other place, using Java SE 1.6 So,

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.