0

I'm currently searching for best practices or experiences regarding the change of the directory structure in a git repository.

The problem: I need to move a lot of files while the rest of my team is working on those. When those branch are merged (probably beginning with the directory structure change), a lot of conflicts are reported.

Example: All code originates from main.

  • A colleague create a first branch work_a from main.
  • I create a second branch structure_change from main. I change the structure from this:
a/
  b/ 
    b1/
      file1.go
      file2.go
    b2/
      file3.go
  c/ 
    c1/
      file4.go
    c2/
      file5.go
      file6.go

to this (moving content of c to b):

a/
  b/
    b1/
      file1.go
      file2.go
    b2/
      file3.go
    c1/
      file4.go
    c2/
      file5.go
      file6.go
  • Another colleague create a third branch work_b from main.
  • I merge my branch structure_change to main. No Issues, history is kept.
  • work_a is merged in main -> Merge Conflict on the directories and subdirectories of c/.
  • work_b is merged in main -> Merge Conflict on the directories and subdirectories of c/.

I need to change the structure, but I would prefer to have as little impact as possible.

Any ideas or suggestions ? Maybe experiences doing the same operation ?

Normegil
  • 157
  • 1
  • 2
  • 9
  • What Git version are you using? The new [ORT merge strategy](https://stackoverflow.com/a/64950077/6309), Git 2.30+, is supposed to be much better at this. – VonC Mar 01 '22 at 08:28

0 Answers0