Home > OS >  renamed folder not reflecting post git merge
renamed folder not reflecting post git merge

Time:09-15

I am having some issue after I merged the code and the package/folder named are not showing as expected.

For example:- in master branch, someone has changed the below package name and pushed the code

com.example.mainDirectory => com.example.maindirectory 

Folder structure

src > java >main >com>example>mainDirectory  ==> src > java >main >com>example>maindirectory

Now in my local branch I am trying to merge the latest code from master, but the folder stanture for the adobe change is not reflecting, it's still showing src > java >main >com>example>mainDirectory instead of src > java >main >com>example>maindirectory

How I can resolve this issue ? so that it should sync with the master branch

CodePudding user response:

I'm guessing this is on Windows. On Linux, case matters for the file system. On Windows it doesn't. There is a very easy two-step workaround:

  • Rename to src > java >main >com>example>maindirectory2
  • Rename to src > java >main >com>example>mainDirectory

The first rename tells both Git and Windows that the directory has renamed. The second rename does the same but gives you the result you want.

CodePudding user response:

Here are 2 possible explanations for this:

  1. Both paths exist in the repo, differing only by case. You can check if this is the case (pun intended) using this command.
  2. Only the new path (with the desired casing) exists after the merge, but Git was unable to rewrite those paths, perhaps because they were locked at the time the merge was performed. In this case, make sure your working state is clean, delete the path with the wrong casing, and then git reset --hard HEAD to re-check out the new path with the desired casing.
  • Related