Tagged: git
- This topic has 7 replies, 3 voices, and was last updated 5 years ago by Brian Fernandes.
-
AuthorPosts
-
MorkParticipantI 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.
Brian FernandesModeratorMork,
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 rungit 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 theAdd to Index
action is enabled, does clicking that somehow put the file directly into the staged state?
MorkParticipantThanks 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, 4 months ago by Mork.
Attachments:
You must be logged in to view attached files.
support-swapnaModeratorMork,
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-changes3. 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 SupportAttachments:
You must be logged in to view attached files.
MorkParticipantThanks 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,
Brian FernandesModeratorMork,
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!
MorkParticipantThanks 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,
Brian FernandesModeratorMork,
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.
-
AuthorPosts