Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here's one way you can do this, and still maintain some relationships between master and the branches. You'd probably want to script it. Excuse me if I use bash statements rather than windows command line for some of my examples</p> <p>First clone the whole repository out, as in your first example, with branches as directories.</p> <p>This moves the trunk to the root. (hopefully there are no conflicts with your branch folders)</p> <pre><code>mv trunk/*.* . </code></pre> <p>Commit your new master</p> <pre><code>git commit -a -m "refactoring master" </code></pre> <p>creating a new branch</p> <pre><code>git checkout -b feature-login </code></pre> <p>Copy the branch files over the root files</p> <pre><code>mv feature-login/*.* . </code></pre> <p>Don't need these here any longer</p> <pre><code>rm -rf [all_branch_directories] </code></pre> <p>Commit the branch </p> <pre><code>git commit -a -m "refactoring feature-login" </code></pre> <p>back to master</p> <pre><code>git checkout master </code></pre> <p>Do it all again</p> <pre><code>git checkout -b next_branch </code></pre> <p>etc. etc..</p> <p>Finally at the end </p> <pre><code>git checkout master rm -rf [all_branch_directories] git commit -a -m "refactoring master" </code></pre> <p>It's not perfect, but you end up with all your branches cloned off master and diffed more or less appropriately. AFAIK git should be fine if you overwrite a file with another file but the contents don't change, which allows this to all work.</p> <p>One downside is that you won't clear out any files in the branches that have been deleted from the trunk. This may or may not be an issue for you...</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload