I'm currently working on a modification of a big e-commerce platform
A large amount of initial development had been done before started on the project, and none of it was under any version control, so I have no file history.
In order to build a picture of all the previous work that had been done, I started with a clean install of the platform, and merged in all the previous changes bit by bit under git version control.
I now have two almost identical copies of the software, one is the working development server, the other is my local repo with a change history.
I want to clone the repo onto the working copy on the server, without upsetting what is already there.
I don't like the idea of wiping the dev server and cloning my local repository. Is there a better way?
I guess what I need to do is clone the repo, with history, without upsetting the working copy on the server - chrisj 2012-04-05 00:07
You can go to the development server and run git init
to turn the root there into a git repo. At this point, you can push your changes to it (or have it pull from somewhere else, which is probably the better route), which will give it access to the history you've built. Assuming at this point that the history is in origin/master
, you can now do something like git branch master origin/master
to create a master
branch based on this history. And finally, you can run git reset master
to bring HEAD
up on your new master
without modifying the working copy.
At this point, since you said they were only nearly identical, your development server should now be running on top of git, with uncommitted changes representing the differences between the dev server's version and your newly-constructed version.
You could clone the repo into a bare one.
git clone --bare /path/to/repo.git
This will create a repository named "repo.git", which is a bare repository folder. You can copy this folder into /path/to/devserver/, e.g.
mv repo.git /path/to/devserver/.git
Now you have the repository and the devserver files on the same place. If you type git status you are going to see that some files are changed etc. If you stage everything as it is and commit it, you will have the old history + one commit that's the diff between your original repo and the current development server code.
core.bare
set to true
(and possibly some other config settings that non-bare repos don't get) - Lily Ballard 2012-04-05 00:21