torstai 20. kesäkuuta 2013

Git subtrees and contributing upstream


I needed Puppetlabs Apache -module, so I added it into my vagrant training repository with following command

git-subtree add --squash --prefix=puppet/modules/apache https://github.com/puppetlabs/puppetlabs-apache.git master

As I started to use this module, I spotted a minor commenting error: one class parameter was removed, but it was still
used in comments. This seemed to be a good place to train to contrinute into upstream repository using github workflow.

First I cloned the puppetlabs/puppetlabs-apache in github, and then I tried to pull it as subtree

git subtree pull --prefix=puppet/modules/apache --squash https://github.com/jyrkiput/puppetlabs-apache.git

Didn't actually do anything, as puppetlabs/puppetlabs-apache.git and jyrkiput/puppetlabs-apache.git were both at same commit. So I'm not sure if this was actually needed.

I did just a minor fix, git add -u and git commit, then

git subtree push --prefix=puppet/modules/apache git@github.com:jyrkiput/puppetlabs-apache.git #21262

Some counting happened, and then the commit was transferred to github. Branch name #21262 is ticket number from Puppet Labs issue tracker.

Then I made a pull request to puppetlabs-apache, which got merged in few days. When I got a message telling me that the pull request had been merged, I wanted to see how I could pull changes back. So I tried

git-subtree pull --prefix=puppet/modules/apache https://github.com/puppetlabs/puppetlabs-apache.git master

But this caused a lot of conflict. But adding --squash removed those.

git-subtree pull --squash --prefix=puppet/modules/apache https://github.com/puppetlabs/puppetlabs-apache.git master

I'm don't know if usage of --squash was a mistake, or should I have gotten the whole history? Anyway, I managed to go contribute into upstream project using subtrees.

Ei kommentteja :

Lähetä kommentti