At one point, I had the following proper Drupal development workflow: local development environment (using Mamp), dev server for testing and a production server, and I used GIT to deploy the changes from the local to the repository and then I would pull from the repository into the dev or production server. MAMP was causing me a lot of issues so I uninstalled it in favor of setting up a LAMP stack in a more traditional way. But I'm using a Mac and things got really wonky. I basically messed up my local dev environment beyond all repair and wasn't able to use it but I had an aggressive deadline for a project.

I began to make many changes to the website on the dev server and then doubling the work on the live site, no longer using the local environment or pushing the changes up using GIT. During this time, I didn't commit any of the changes to GIT either. Basically, GIT and the local dev have been out of the picture for the last several months.

Since my last commit, the following situations have changed.

  • created a new git repository that I want to use
  • my local dev stack is still non-functional
  • I want to set up a new host so I can test my existing dev site for current hosting issues

Where do I go from here in order to get back on track so that I can move the current website to a new host and preserve the GIT history without being able to use a local dev environment?

  • 2
    Basically to preserve git history, you need to retain the .git folder in the project. It's hidden unless you look with command line or git GUI. If you've deleted that, any past history is gone.
    – Kevin
    Mar 24, 2017 at 23:48

1 Answer 1


Commit the changes on the live site to the master git branch and then branch off this to create a develop branch.

The master branch should mirror live and development takes place on individual branches, when you're ready merge or pull request onto the develop branch. When ready to go live merge or pull request into master.

  • How is it possible to push from a remote host to the repository? I am using Debian and all access is done via public ssh key. Thus, if I try to push code from the production site to the new Git repository, I get access denied.
    – Christia
    Mar 27, 2017 at 22:45
  • 1
    You will need to generate a new public/private key pair for the production server and then add them into the Git repository Mar 28, 2017 at 9:18
  • This is the right answer. I ran into a different snag wherein I can't push because of some large included several commits back. I'll have to search for that.
    – Christia
    Mar 31, 2017 at 1:16
  • It's covered at git-scm.com/book/en/v2/… but can be quite difficult Mar 31, 2017 at 10:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.