Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-07-10 12:05:29

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Contributing code on GitHub

Here we are, time to contribute some code.

From the GitHub repository’s CONTRIBUTING.textile:

Contribute code

    1. Pick an existing issue you intend to work on, 
        or create a new issue if no existing issue matches your topic.
    2. Fork the repository on GitHub.
    3. Make a new branch for your work.
    4. Hack along.
    5. Push your changes to your fork on GitHub.
    6. Visit your repository’s page on GitHub and click the ‘Pull Request’ button.
    7. Label the pull request with a clear title and description.

I’m fuzzy on #3, why do I need a branch on my fork?

If I’m making changes to my own Fork wouldn’t I just apply the changes to it’s master branch? Then do a pull request from my fork’s master branch to TXP’s master branch?

I could see doing a branch for something major, but a simple change wouldn’t warrant a branch? I may be wrong, that’s why i ask.

Offline

#2 2015-07-10 12:51:20

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: Contributing code on GitHub

forum.textpattern.com/viewtopic.php?pid=290283#p290283

Last edited by CeBe (2015-07-10 12:53:34)

Offline

#3 2015-07-10 13:18:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: Contributing code on GitHub

hcgtv wrote #293043:

why do I need a branch on my fork?

You don’t necessarily need to, but it’s a good habit to get into. As you say, if it’s a simple change then by all means patch directly on master. It saves a round of merge/commits, which keeps the logs cleaner.

But the advantage of making a branch is that if your so-called simple fix has unexpected ramifications and ends up taking far longer than you anticipated, you can freely hop back and forth between the two (providing all changes are committed or stashed). Up to a point, it’s also handy for comparing what the new branch does compared to the original if your current dev install points to your development directory :-)

Another benefit is if you’re midway through the mods to your branch and come up with a new function that would not only help your new feature but also the community at large right now, you can hop into the master branch, implement it, commit/push it, hop back to your branch and issue git merge master to pull it into your branch. It gives you more flexibility at the expense of a few more commands and the overhead of periodically resynchronising the two branches.

But certainly not a requirement, just a recommendation. I’ve been caught out a few times and gone “if only I’d made a branch first”. If you’ve yet to commit anything, it’s not much hardship to add one at that point and start work there instead. But if you’ve already committed some stuff to master for your feature that you mistakenly thought would be a five minute job, you have the unenviable choice of unpicking it all and migrating it to a branch, or just starting the branch from “now” and having it not represent a complete feature.

Branches can always be deleted if you decide to change approach too, with no impact on the master branch.

Last edited by Bloke (2015-07-10 13:22:44)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#4 2015-07-10 22:24:06

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Contributing code on GitHub

Breaking News!

Textpattern has been forked 41 times!

Getting the hang of this, forked the project over to my user, super easy on GitHub. Now I’ll play with my repo without feeling nervous, which is what I think the majority of us feel when Git enters the conversation.

Muchas gracias Claire and Stef por los breadcrumbs.

Offline

#5 2015-07-11 07:15:43

CeBe
Plugin Author
From: Caen - Fr
Registered: 2010-06-25
Posts: 345
Website

Re: Contributing code on GitHub

hcgtv wrote #293057:

forked the project over to my user, super easy on GitHub. Now I’ll play with my repo without feeling nervous

Welcome on board, Sir! :D

Offline

#6 2015-07-11 15:13:19

hcgtv
Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

Re: Contributing code on GitHub

CeBe wrote #293069:

Welcome on board, Sir! :D

Thank you, I promise not to rock the boat too much.

WordPattern

Offline

Board footer

Powered by FluxBB