So you’d like to fix a bug or contribute code to the First Responder Kit, but you’re new to Github. Let’s get started.
1. Open a new issue on Github.
Go to the Github issues list for this repo, and start a new issue. Here’s the example that I’m going to work on today:
In the issue title, put the name of the script, and some basic details so someone can see at a glance what’s going on.
In the body of the issue, put as much details as you can including:
- Description of the symptom
- What you wanted the code to do
- What it actually did instead
- Ideally, how you want to fix it
And submit the issue. If you’re going to work on it yourself, assign yourself to it if you have the permissions. (If you don’t, join the Slack channel, then hop in and ask.)
2. Get the Github issue number.
After you add the issue, the number will be in the title, and at the end of the URL:
Now it’s time to work on some code!
3. Fork & download the repository.
First, get a Github account and install the Github desktop app. While this can all theoretically be done through the web, it’s a bit painful.
Then go to the First Responder Kit’s page, and click the Fork at the top right to fork this repo into your own account. (It’s kinda like doing a File, Save As to edit your own copy of something.) Then in your forked version of the repo, click Clone or Download button at the bottom right of this screenshot:
That will open your Github app and let you pick where to save the files locally.
4. Create a branch for your code.
In the Github desktop app, click on the new-branch button to create a branch for the specific issue you’re working on.
For the name, use the issue number from Github, plus a slash and your name. This indicates that it’s your code for that particular issue – remember that other people may end up working on this same issue.
5. Write your code, test it, and check it in.
For code guidelines, check out the CONTRIBUTING.md file in the repo.
Test your code against a case-sensitive instance of SQL Server 2008 and 2016, the oldest and newest supported versions. Other testers will also repeat your work, and automated testing will kick in later, but trust me, you want to do a sanity check first. Don’t get your pants pulled down in public.
Then click on the “1 Uncommitted Change” button at the top of the Github desktop (and there may be multiple changed files) and review your changes. They’re color-coded as to which lines have been removed from scripts, and which lines have been added.
Only check in changes and files that relate to your issue. If you accidentally changed a file that you didn’t mean to, in the Github app, right-click on that file name and click Discard Changes.
At the bottom left is your check-in title and description.
The title should:
- Start with the issue number, like #324 – this is Github magic to link to an issue
- Include the names of the files that were changed – this is helpful to others when they’re scanning a long list of titles of check-ins
- A brief description of the issue
Then click Commit, and click Publish at the top right to sync your changes with the rest of the world. This doesn’t merge your code with the toxic sewer that is the dev branch just yet – you’re still on an island by yourself, but at least other people can get to your code.
7. Announce that your code is ready for testing.
Go back to your Github issue, and add a comment (don’t close it) that says you’re ready for testing. Include a link to your code, and any notes on how people can reproduce the issue, or know that your code works.
In the Labels dropdown on the right side, add the label ReadyToTest so folks can find your work easier.
Someone else has to test your code before it gets merged into the main branch, so it’s in your best interest to make it as easy and friendly as possible for someone to know that your code works.
8. Ready to merge? Add a pull request.
After someone else has tested your code, and you’re both happy that it works, open the Github app and click Pull Request at the top right:
For the remote branch, pick the Brent Ozar Unlimited First Responder Kit repo, the DEV branch. The check-in title and description will flow into here automatically, and click Send Pull Request. The maintainers will take a look at it and make sure things are kosher.
Stuff you don’t have to do
Release notes and changelog – you’ll notice that the top of each script has a changelog, version number, date, and release notes. Those are added when we consolidate a group of pull requests into a single release.
Documentation – if you don’t feel like writing it, that’s totally okay. We’re happy just to get code in at least, and we understand that the kinds of folks who write code don’t always overlap with the kinds of folks who like to write documentation. If you write things like a new check for new SQL Server problems, just know that we may not merge your code in with the dev branch until it’s also been documented.
For questions about the process, hop into the Slack channel. If you’re not already a member, sign up here. And thanks!
Thanks for the opportunity to contribute! I’ve been wanting to get into this since it was open-sourced… in my “spare time” which I haven’t been able to find. Got the repository in my git, at least.
You have ‘Spare Time’?!? Pass some my way when you get a moment, as there always seems to be far too much to do on any given day.
Thanks for the well written tutorial Brent.
I must admit that its too precious to just give away… You may have some of my ‘spare tire,’ though. Who luvs ya? 😉
Now we need to get this work with Cortana and maybe Hololens… 🙂
Brent, you’re missing a step at the top. Since us normal people don’t have permission to commit to the BrentOzarULTD repo, we need to Fork it to our own github repo (as step 2.5), then download the repo from github.com//SQL-Server-First-Responder-Kit
Doh! Good catch, updated the post to include that. Thanks sir!
I figured I’d wasted enough time for everyone in my attempt to learn to git.