-1

I have initialized a directory with git:

git init

And then added all the files:

git add .

After that, I manually (through OS) renamed one directory (from Attr to attibutes).

Then I continued my coding, now that I want to commit the changes, it says:

Changes not staged for commit:

deleted Attr/file.jpg
/..... a list of similar files which are in renamed directory

How should I solve this problem? I did:

git update-index

But it did neither work.

Mostafa Talebi
  • 8,825
  • 16
  • 61
  • 105
  • 1
    use `git rm` on the old and `git add` on the renamed – Andrew C Nov 28 '14 at 00:48
  • Can I know why do I have received down-votes? – Mostafa Talebi Nov 28 '14 at 10:29
  • Downvotes are reserved for questions which fulfill the following definition: "This question does not show any research effort; it is unclear or not useful". Handling renames in git is something very basic and a simple google search with the keywords `git`, `rename`, `folder` or `files` should have led to a satisfying answer. This in turn implies no research effort on your side which probably resulted in the downvotes. – Sascha Wolf Nov 28 '14 at 11:02
  • possible duplicate of [In a Git repository, how to properly rename a directory?](http://stackoverflow.com/questions/11183788/in-a-git-repository-how-to-properly-rename-a-directory) – Andrew C Nov 28 '14 at 17:28

1 Answers1

4

you can debug it as "git status" -> it will show the staged,modified and untracked file.

1.Here you will find "Attr" in changes to be commited or staged status.So here you apply "git rm Attr" 2. In untracked list you will find newly created or renamed file i.e attibutes. So for untracked files you just apply command "git add attributes".

Now you can commit your changes.

shaishaw
  • 156
  • 3