0

I have a problem with my project in Eclipse IDE. For the first time, I worked on an old version and made several changes.

I tried to upload the project on GitLab for the first time I configured Git on Eclipse IDE and I tried to commit and push "but I could do that only after doing a 'Fetch' from the remote branch and commit the 'Merge' change in my local repository.

Because I got this error:

rejected non-fast-forward

I followed this link Egit rejected non-fast-forward to fix it.

The fetch downloaded all the git project files in my project on Eclipse. Until now in my project, I have a subfolder like this: myProject/myProject.

I made several commits and push and it works normally. I figured out that a subdirectory in gitLab docroot is created with every push I make.

This is the local project structure:

structre_eclipse_project_problem

This is the project structure on GitLab:

structre_project_gitlab

I want to delete docroot/WEB-INF/classes from GitLab.

How to delete this commit from GitLab using git plugin in Eclipse and how to correct my local project structure?

howlger
  • 31,050
  • 11
  • 59
  • 99
NewDark Magic
  • 55
  • 1
  • 3
  • 10

1 Answers1

0

docroot/WEB-INF/classes is a folder. Git does not track folders, only files:

  1. To delete a folder, you have to delete all the files in it.
  2. In the Git Staging view, commit the deletions.
  3. Make sure your current local branch is configured as When pulling: Rebase (in the Git Repositories view right-click the branch and choose Configure Branch...)
  4. Git > Pull to make sure your commit is the latest commit in the upstream branch. If there are conflicts, you have to resolve them in the Git Staging view
  5. Git > Push to Upstream

For details see the EGit User Guide and be aware that old Stack Overflow answers refer to outdated version of EGit.

howlger
  • 31,050
  • 11
  • 59
  • 99
  • In my project I have a subfolder `myProject/myProject`. I want to work on the project that exists on gitLab. I was working on the top project not on the subfolder which exists on gitLab because I can deploy and execute only the top project in my Eclipse server. pls check the local project structure. how to fix that? – NewDark Magic Nov 28 '17 at 08:56
  • `docroot/WEB-INF/classes` has probably the attribute _derived_ and is therefore only visible in the _Navigator_ view. Resources that are not in your workspace are shown in the _Git Repositories_ view below the _Working Tree_ node. If there is a problem, tell which step doesn't work: change the structure, commit changes, pull from upstream or push to upstream. – howlger Nov 28 '17 at 09:14
  • pls see the local project structure and tell me what should I delete exactly. you said "you have to delete all the files in it." does it means all sub-repertoire too? – NewDark Magic Nov 28 '17 at 09:27
  • Yes. In Git you will only have files, e. g. you can not commit an empty folder. Folders only exist as paths to files in Git. Assuming you have the single file `path/to/file` and remove it and commit the deletion, the folders `path/to/` and `path/` will disappear in Git even if they were not deleted. – howlger Nov 28 '17 at 09:38
  • I deleted the wrong folder but now my local projet will not work because I delete that folder. I can not deploy or execute my project. – NewDark Magic Nov 28 '17 at 09:51
  • The folder is deleted from gitLab but I can not run or deploy my local projet. I do not know if you understood me or not, I can deploy and execute only the top project in my Eclipse server. – NewDark Magic Nov 28 '17 at 10:07
  • If _"I deleted the wrong folder"_ can be read as I deleted some files by mistake: in the _History_ view right-click the commit that has be done by mistake and choose _Revert Commit_. This creates a new commit that undoes all changes of the commit to revert. Don't forget to push the revert commit to the upstream repository. – howlger Nov 28 '17 at 10:32
  • I recreated the delete folder manually in my local project and since now I have to work on the project up run it and deploy it, and then I must copy its contents in the **subproject** and make a commit and push to gitLab of subproject. – NewDark Magic Nov 28 '17 at 12:03