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

  • Home
  • SEARCH
  • 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 6111363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:37:19+00:00 2026-05-23T14:37:19+00:00

After getting past a few hurdles learning Git, I came across a new challenge:

  • 0

After getting past a few hurdles learning Git, I came across a new challenge: Renaming a directory (locally, in the working directory).

When I type git status, it lists all the files in the old directory name (that exist with the same exact filenames in the new directory) as deleted and the new directory name as “untracked”.

Is there a way to tell Git that “it’s actually the same directory, just a different name”?

So that all the files will be listed by git status as modified only?

To exemplify the problem, here is the output I receive from git status when I rename an entire directory:

git status
# On branch master
# Changes not staged for commit:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#   deleted:    old-dir-name/file1
#   deleted:    old-dir-name/file2
#   deleted:    old-dir-name/file3
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   new-dir-name/
no changes added to commit (use "git add" and/or "git commit -a")
~/sb/ws>
  • 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-23T14:37:20+00:00Added an answer on May 23, 2026 at 2:37 pm

    All answers here were very helpful on the way to the actual solution for the particular scenario I was facing. I am providing what worked for me in the form of actual steps, hopefully helping others encountering the same challenge:

    1. git mv <old-dir-name>
      <new-dir-name>
    2. git status (verify that all files
      marked renamed, not “deleted”)
    3. git commit -a -m "git mv
      <old-dir-name> <new-dir-name>"

      (this is a “fake” commit, to prepare
      for the real rename in the next
      steps)
    4. git branch
      git_mv_20110708_1500_DO_NOT_USE

      (“fake” branch with timestamp
      reminding that we only did this as a
      workaround)
    5. /bin/rm -Rf <new-dir-name>
    6. cp -Rp .../<new-dir-name> . (copy
      over the actual folder with the
      renamed name)
    7. git status (most modified files
      will now be marked correctly as
      modified, not “deleted”. Files that have been renamed will be
      marked as deleted and added,
      despite having the same content! — repeated steps 1-7 for those files if rename tracking is needed for them too)
    8. git add <untracked files>
    9. git commit -a -m "finally renamed
      this folder"
    10. git branch FOLDER_RENAMED 🙂

    P.S. gitk loves this, but Emacs is still confused with the renames. 🙁

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

Sidebar

Related Questions

After getting fine answer to my previous question , I came across another problem.
I am getting back into a bit more .NET after a few-years of not
After getting the objectEnumerator in the following code, the set1 retain count goes to
After having solved the problem of getting the editor to launch when there's a
I'm getting back into .NET after numerous years in PHP/MySQL back in 2002 on
I'm getting this error after trying to appendChild to an element that was just
I'm getting back into .NET development after a couple years and it seems that
After using AS2 for several years, I'm getting started with writing applications in AS3
I'm just getting back into C++ after a couple of years of doing a
I am getting a strange exception when trying to update a DataTable after flagging

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.