Search code examples
javagitegit

A copy/paste file cannot be added to git stage


I have an eclipse project which is under version control using eGit.

I copied a java file and pasted with a new name in a new package. I changed the content of the file, but I can see the new file in unstaged changes.

Can you please help me to add it?

Thank you in advance!


Solution

  • I found that my file was included in .gitignore file.

    I used the eclipse terminal and move to the directory that contains the file.

    Then I used

    git add -f filename.java
    

    Now I can see the file in unstage changes file list.