Skip to main content

Quick tips: Adding an existing project to a sandbox

An article from ComputerMinds - A leading UK Drupal development agency since 2005
19th Jul 2011

Steven Jones

Senior Developer

Most projects start with you trying out something locally, getting it working and then after some initial testing you might then want to publish the project on Sandboxes are a great way to throw up some code and the perfect place to pop random code that others might find useful or a project that you just don't want to maintain. If you go and create one on then you'll get helpful instructions for creating a new git repository and creating a basic module to go in the repository and then pushing that code to's servers. But what if you have put your development in a local git repository already? Well, it's really simple to push that code up to a sandbox too, with the minimum of fuss.

Start by adding a remote to your local git repo:

# Replace USERNAME with your git username, and SANDBOX with your sandbox number.
git remote add origin

Then you can push your local master branch into your sandbox by just doing:

git push -u origin master

The -u options means that git will set your branch up to track the remote one, which will make future git pulls and pushes easier.

For extra bonus points, if you've been developing a 7.x version of your project, on a local master branch, but you don't want a master branch on then you could do this push instead:

git push origin master:7.x-1.x

Note that I've not used the -u option here, as I'd probably bring down a tracking branch of the new 7.x-1.x branch next, and delete my local master branch.

git pull --track origin/7.x-1.x git branch -d master

Hi, thanks for reading

ComputerMinds are the UK’s Drupal specialists with offices in Bristol and Coventry. We offer a range of Drupal services including Consultancy, Development, Training and Support. Whatever your Drupal problem, we can help.