![]() |
A git workflow that always give you clean pull requests :) |
This post is for all you naughty folks out there who forked a github repo, hacked on master, and now are repenting because you have no way of clearly and efficiently sharing your hacks with the original (forked) repository.
If you had kept your master clean, you could branch it and easily issue a pull request !
When master is clean, you can create a clean feature branch from it and rapidly issue a pull request to the home repo. The diagram above represents this workflow.
Okay, so what if you already gunked up your local master? Well, then here is the approximate workflow you will follow.
Clone down your fork if you havent already:
git clone git@github.com:gluster/my-fork-parent-project.git my-fork
Add the upstream repository as a remote:
git remote add upstream git@github.com:gluster/parent-project.git
And finally, the magic part:
git fetch upstream git checkout -b remote_master upstream/master
This creates a PURE copy of the remote master that you can use to branch off of for pull requests.
And now you can hack on "master" all you want... But, after this traumatic experience, I'm sure you will NEVER do THAT again :).
No comments:
Post a Comment