The Gluster Blog

Gluster blog stories provide high-level spotlights on our users all over the world

Git: Reincarnating remote “master” branch so you can easily PR to upstream

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 my-fork 

Add the upstream repository as a remote:  

git remote add upstream

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 :).


  • 06 Dec 2020
    Looking back at 2020 – with g...

    2020 has not been a year we would have been able to predict. With a worldwide pandemic and lives thrown out of gear, as we head into 2021, we are thankful that our community and project continued to receive new developers, users and make small gains. For that and a...

    Read more
  • 27 Apr 2020
    Update from the team

    It has been a while since we provided an update to the Gluster community. Across the world various nations, states and localities have put together sets of guidelines around shelter-in-place and quarantine. We request our community members to stay safe, to care for their loved ones, to continue to be...

    Read more
  • 03 Feb 2020
    Building a longer term focus for Gl...

    The initial rounds of conversation around the planning of content for release 8 has helped the project identify one key thing – the need to stagger out features and enhancements over multiple releases. Thus, while release 8 is unlikely to be feature heavy as previous releases, it will be the...

    Read more