facebook

Git not adding changed files to unstaged changes area

  1. MyEclipse IDE
  2.  > 
  3. Installation, Configuration & Updates

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #617095 Reply

    Mork
    Participant

    I recently added a new Java class to a package where when I change the other Java files in that package, they appear in the unstaged changes area. Yet, this new Java class does not appear in the unstaged files area after I make a change. There is a ! in a yellow triangle to the left of the Java class.

    I’ve right-clicked the file and gone to Team to see if perhaps the class wasn’t added to Git yet, but there’s nothing I find that says anything like “add to repository”.

    The file is included in the maven build so the project knows about it, just not Git.

    What am I missing?

    Thanks very much in advance.

    #617123 Reply

    Brian Fernandes
    Moderator

    Mork,

    An odd problem indeed.

    1) As a test, if you create another class in the same package or another package in the same project, do those appear in Unstaged?
    2) Can you run git status from the command line, from a folder containing all the classes in question, and paste the output here?
    3) From the project explorer, if you bring up the context menu for the file in question, and go to the Team sub-menu, what options do you see there – can you send a screenshot? If the Add to Index action is enabled, does clicking that somehow put the file directly into the staged state?

    #617137 Reply

    Mork
    Participant

    Thanks for writing back.

    Below are the answers to your questions.

    1. No. I created another Test.java file and even did an “Add” using the Git explorer, but the file did not show up in unstaged files when I created it or made a change.

    2. git status in the directory gives me this:

    $ git status
    On branch develop
    Your branch is up to date with ‘MyE-Project/develop’.

    3. I attached the screenshot showing what happens when I click on the file and go to team menu.

    Strange, right?

    If I change the repository to “master”, which was what I used for the initial commit, then the staging problem seems OK, but in this view there is no pom.xml so nothing really works there either.

    Am I officially in Git heck?

    Thanks,

    • This reply was modified 5 years, 5 months ago by Mork.
    Attachments:
    You must be logged in to view attached files.
    #617157 Reply

    support-swapna
    Moderator

    Mork,

    Thank you for the details and the screenshot.

    1. Can you please recheck if there is a check on a local branch, indicating that it’s correctly checked out? Please see attached screenshot for your reference.

    2. Please refer to these links which discuss similar problem with Git and see if any of the suggestions help :
    https://stackoverflow.com/questions/9707562/git-is-not-detecting-a-file-and-is-not-in-gitignore
    https://stackoverflow.com/questions/43528891/changes-dont-appear-in-unstaged-changes

    3. Rather than trying to figure things out, it might be easier & faster for you to save the modifications you’ve made manually, and check out your branch again and/or perform a hard reset of the branch. This should ensure that your checkout is in good shape and you can try making the changes again.

    Hope this helps. Please let us know how you get on with this issue.

    –Swapna
    Genuitec Support

    Attachments:
    You must be logged in to view attached files.
    #617160 Reply

    Mork
    Participant

    Thanks for the ideas, but none of these suggestions work. Yes, the “develop” branch had a check. I clicked “Add to index”, but nothing happens. I did a hard reset of the develop branch, but nothing changed. Yet another Java class in the same package is tracked fine.

    Seems like it must be a Git bug. I’ve never seen anything like this in Intellij, but I think the native Git implementation there is much superior to this plug-in (which seems to have lots of complaints and issues about).

    Since the project builds OK, I guess for the moment I’ll have to live without Git tracking this file.

    Appreciate your help.

    Thanks,

    #617222 Reply

    Brian Fernandes
    Moderator

    Mork,

    Sorry to hear those suggestions didn’t help 🙁

    In-house, we use eGit all the time and we’re quite happy with it. Of course, not saying it’s bug free, but I have a feeling your particular issue has more to do with the state of your repository. The git status command, executed on the command line, is independent of eGit, and it should have reported the class as an untracked file. If it does not, then eGit will likely behave in the same way.

    Hope you do get it sorted out, good luck!

    #617235 Reply

    Mork
    Participant

    Thanks Brian,

    Is there any way to remove git completely from a project and re-add it without losing any files/data?

    I really don’t care if I lose all the incremental git history as much as I care I can actually do a commit and a push.

    Thanks in advance,

    #617352 Reply

    Brian Fernandes
    Moderator

    Mork,

    Giving you some OS level ideas, which I hope will be a fool proof way of resetting your project.

    1) Shut down MyEclipse to avoid file locks.
    2) Copy your project (with your mods) into another location on your system.
    3) Delete the git project you were working with from the file system – I’m assuming the repository is remote.
    4) Check out the project again from the remote repository.
    5) Copy the new / changed files over from the copied location to the checked out location.

    Can’t think of anything more basic than that – I hope that gets it working.

Viewing 8 posts - 1 through 8 (of 8 total)
Reply To: Git not adding changed files to unstaged changes area

You must be logged in to post in the forum log in