0

I apologize in advance. I am very new to git and I just took over a project that is stored in git.

Here is my situation - The project I took over has a directory structure that isn't standard in my organization.

I created new branches with the new dir structure, I used git mv. I need to make the branch names standard. There is already a branch with a standard name but with the wrong dir structure.

I am working on a branch named "develop", it has the dir structure we want. I mostly understand merge, but I don't quite understand rebase yet. Essentially I need to make the other non standard branches be exactly like the "develop" branch.

Merge won't work because of the dir structure changes, I have already tried.

How do I simply make the other branches exactly like "develop"?

UPDATE:

I realized I could practice as long as I didn't push to remote.

Previously, I picked one of the branches to change the dir structure ("test" branch):

cd into the dir that you want to move files into

Type this command (this represents the current dir structure that you want to change)

git mv OldDir1/OldDir2/* .

Notice the period at the end, following the space after OldDir2/*

Commit and push. Note: this will delete the history of each file.

I also did this to the "develop" branch earlier.

Now, both branches (develop, test) have the new dir structure.

Then:

git checkout develop git checkout test git rebase develop

At this point, it couldn't resolve the podfile and podfile.lock files.

Sourcetree showed pull (2) and push (number of commits ahead).

I tried several things and couldn't get sourcetree to take the podfile from develop, it kept wanting to take the podfile from the test branch.

It wouldn't push until I resolved the pull (2), which was the two podfiles mentioned.

I finally just pulled the two podfiles and commited/pushed even though they were out of date.

I will change them and push.

This accomplished what I wanted, and I have check several files for recent changes to make sure "test" is current with "develop".

flhhc
  • 19
  • 4

1 Answers1

1

This isn't something you want to do for well-defined, and well-worked projects, but you could simply checkout your master branch and replicate what you did to your "develop" branch.

I don't really see why you can't merge "develop" into your "master" branch, but if you have merge conflicts, perhaps pulling those into your "develop" branch, resolving (what will probably be an awful lot of) conflicts, and re-merging to master could be a solution as well. You can do this all locally without pushing anything to your origin, so it's "safe" as long as you don't push to origin. If you feel confident that the structure is what you want, you push to "origin" and your changes will be visible to everyone else working on that project.

dckuehn
  • 2,427
  • 3
  • 27
  • 37