Most of us use the Dropbox service as cloud storage for the files that we need most often. And probably a big number of us [developers] use the GitHub service to host our code. And, at least, the official plugin and theme repository at wordpress.org isn’t meant for developing and pushing each commit separately. Some might know the following statement
“If I catch you at it, then I will ban you from WordPress.org. The SVN only needs your final working version committed to it, not the entire history of the hundreds of changes you made using Git. Flatten your changes to a single commit.”
So we decided to go with Dropbox as our local, private and GitHub as our public facing repository. In the following article I will try to also show you how you can use both locations for your repository (where Dropbox goes first/is the main repo container) and gather as much info about your remotes as possible.
Checking, rechecking and reading the info provided by, is one of the best things you can do to better understand git and what’s going on behind the scenes in your repositories.
To continue, you’ll need to have the have Git GUI installed. At least if you want to try it out and not just read it. First we need to init a bare repo in our local Dropbox folder. A bare repo is different from a cloned repo as it doesn’t contain any code, but some very cryptic files instead (we’re not diving into this topic now). Let’s open our Dropbox folder and add a new folder in there, named like the actual development folder of our plugin. Then open Git Bash or your preferred CLI and switch over to our new Dropbox plugin folder.
# Init the bare repo git --bare init
After we did this, we head back to our local development folder and do a basic
git init there. Finally we just need to add our new remote source: The Dropbox folder.
# Init the repo git init # Now add the remote source # Make sure your path matches git remote add dropbox /C/Dropbox/plugin-repos/plugin-name
Of course, you could just
git clone your Dropbox repository or manage the cloning via calling
git gui, but I prefer doing the above. Now, as a last step, we add a new repository to our GitHub account from within their web interface. After you created it, you’ll find three different types of addresses that GitHub offers: * HTTP:
https:// * SSH:
git@ * Git Read-Only:
git://:// To add our GitHub repository as second remote location, we’re going to use the SSH link. This will avoid prompting us for our username + password on every commit. The only thing we need for this up front is our
SSH key set up. We’ll name our GitHub remote location
origin as this is somewhat the default name (as
master is the default name for the production/working branch). This will make it much easier for your to read and understand different tutorials you may find in the internet.
# Add GitHub as second remote location git remote add origin email@example.com:username/plugin-name.git
Now we’re ready to go and can commit and push to Dropbox as well as to our GitHub account. Just make sure to select the right location when pushing. And to be sure that everything went right, we’ll also check our remote locations (and, in case, remove the wrong ones).
# Check first # This will output a list of remote locations git remote -v # There's also an alias that is easier to remember git remote show # In case something went wrong, we remove the location git remote rm dropbox # If we just had a typo in our remote location name, # we can simply rename it git remote rename prodpox dropbox # Finally, after pushing, we check the details of our remote source # In case we have branches this will also show us # if our branches are properly linked git remote show dropbox # Now we just check the state of our repo git status
A final note: A
commit just adds data to our queue. It doesn’t push anything. You can commit and commit as long as you want and then, as final step, push your commits to your remote locations. Until you didn’t push, you’ll won’t be able to see any changes in your GitHub account and
git status will always tell you that you have “unstaged changes”. Use this command as often as possible (or just hit