Skip to content

HowTo: track upstream changes

dkingofpa edited this page Jul 17, 2012 · 8 revisions

By default the remote origin is the vagrant-drupal repository on github. It is designed to function after you clone it for development and testing purposes. This means you can commit to your local repository and track upstream changes. This is useful for single user development workflow. However we also kept in mind people work on teams and need to share these repositories for each project they are working on. To do this we recommend the following.

  1. Rename the remote origin: git remote rename origin github
  2. Create your bare repo
  3. Add your own remote origin: git remote add origin <your_repo_name>
  4. Set your master to the remote origin: git config branch.master.remote origin
  5. Push your changes to your bare repo: git push origin master

Adding vagrant-drupal to your existing project

If you are cloning directly from our repo it won't contain the original github project. In that case, you will need to add the upstream remote:

  • git remote add github git://github.com/xforty/vagrant-drupal.git

Then follow the steps in Merge in future versions below to pull in the repository. In order to pick up RVM run the following:

  • cd .. && cd -

Merge in future versions

If you are initially adding vagrant-drupal to an existing project or you want to pull in the latest changes run the following:

  1. git pull github
  2. git branch github_develop github/develop
  3. git merge github_develop
  4. Fix any conflicts you have and commit the changes. The more changes you made the more conflicts you are likely to have. See Dealing with merges.
  5. git push origin master
  6. git branch -d github_develop

If the Cheffile.lock file changed you can simply run the following to pull in the new chef cookbooks:

  • librarian-chef install

Dealing with merges

Merging conflicts can be a bit of a pain. If you clone from master you are less likely to get a conflict. If you clone from develop then merge a version tag, you more likely get of conflicts.

When you are in the middle of a conflict you might decide that you want to take all the changes from upstream. You can simply run this command then add the conflicted file.

  • git checkout --theirs README.md

The counterpart is to simply take your changes

  • git checkout --ours README.md

What this does is checkout our version (--theirs) or your version (--ours) of the file.

Git History

One annoying aspect to merging in upstream changes is seeing the history from the vagrant-drupal project. The easiest way to clear that out is to run the following command:

  • git log --first-parent