GitHub + Floobits workflow for remote pairing

Let's say you're pairing with someone remotely using Floobits and you want to make sure both of you have copies of the code you've worked on together. That doesn't seem like an unreasonable requirement, but how do you go about it?

This tutorial assumes that you're using GitHub as your VCS, so if you're using something else you might have to Google around to modify it to your needs.

Things you'll need

  • A GitHub account
  • A Floobits account
  • Access to a terminal on your local machine

The situation

Your pair has set up a workspace on Floobits and you guys spent hours implementing a ton of cool stuff. Your pair then commits all your work and pushes it up to his own GitHub repo, in a branch called pairing

The first thing you're going to want to do is set up a local branch as the fetching area for your pair's repo. Assuming you're currently on your own master branch:

git checkout -b fetch_from_pair  

where you should rename fetch_from_pair to be whatever you'd like. The name is not important, since this is not the branch you're going to be pushing to your own repo.

Next up you're going add a remote coworker (your pair's GitHub repo) and fetch from it, while you're still in your fetch_from_pair branch. You're also going to set the usptream of this branch to the fetched branch you're interested in, which is in this case pairing

git remote add coworker https://github.com/path/to/coworker/repo.git  
git fetch coworker  
git branch --set-upstream-to=coworker/pairing fetch_from_pair  

Now all that's left is for you to pull, and create your own branch. This is the branch you're going to push to your own GitHub repo, so naming here is important (replace pairing_work with whatever you'd like)

git pull  
git checkout -b pairing_work  
git push origin pairing_work  

That's it! You now have a branch on your own repo called pairing_work that reflects all the code on your pair's repository.

One last thing to add, is when changes are made on your Floobits workspace and you need to merge those changes into your pairing_work branch, you're going to want to go back to the fetch_from_pair branch, fetch, pull, merge new changes into your pairing_work branch, and push.

git checkout fetch_from_pair  
git fetch  
git pull  
git checkout pairing_work  
git merge fetch_from_pair  
git push origin pairing_work  

Happy remote pairing!

comments powered by Disqus