Maintaining a branch to reorganize files

Hi,

After discussions with @eraviart and @Seb35 a consensus was reached to add a branch to each *_nettoye repository where the .json files are all at the top level directory instead of being organized in a hierarchy. The primary incentive for this branch is that there is no need to build the directory name, the file can be trivially addressed with its uid.

And this leads to a new interesting problem: how do you maintain two branches that have identical files but in different directories ? A way of doing it is:

  • git checkout master
  • mkdir tmp ; echo **/*.json | xargs -d ’ ’ mv -t tmp
  • git checkout uid
  • rm -fr uid
  • mv tmp uid
  • git add .
  • git commit -m ‘update’

The git checkout uid checks out files that are don’t actully needed and they are removed right away. What is really needed is to change the branch without checking out the files, after updating the uid directory. It can be done like so:

  • git checkout master
  • mkdir uid ; echo **/*.json | xargs -d ’ ’ mv -t uid
  • git symbolic-ref HEAD refs/heads/uid
  • git reset
  • git add uid
  • git commit -m ‘update’

Here is an implementation of the above.