Skip to content

Instantly share code, notes, and snippets.

@ZakGriffith
Last active February 2, 2024 17:23
Show Gist options
  • Save ZakGriffith/69d1eb8baebddd7d370b87a65a7e3ec0 to your computer and use it in GitHub Desktop.
Save ZakGriffith/69d1eb8baebddd7d370b87a65a7e3ec0 to your computer and use it in GitHub Desktop.
BuidlGuidl contribution guidelines and CLI tutorial

All Pull Requests need to reference an existing Issue. If one does not exist, first create the Issue to address your fix or additions


โ›” If you do not have access to the repo, start by forking the repo. The following can be completed on your fork.

๐Ÿ”‘ If you do have access, the following can be done on the repo you are trying to edit.


Overview

Clone the repository

Create and checkout a new branch

  • Suggested branch naming convention is Issue #, hyphen, descriptive name. E.g. '3-FixFormatting'

Make your updates/changes

Commit changes locally

  • Include detailed name/description

Push changes to origin->appropriate branch

Create a Pull Request

  • Link to appropriate issue using 'Fix #'
  • Add all accompanying screenshots, videos, and a detailed description.

Monitor GitHub for comments or update requests to your Pull Request


Detailed CLI Walkthrough

This is an example using repository https://github.com/carletex/github-foo.git and branch name 3-FixFormatting. You will want to use your appropriate repository and branch name when following along.

Clone the repository

git clone https://github.com/carletex/github-foo.git

image

Create and checkout a new branch

Navigate to your new project folder, then we'll create and checkout our branch.

๐Ÿ›‘ If you want to use a branch other than main, you need to checkout that branch before proceeding!

The new branch should follow the naming convention of: Issue number, hyphen, descriptive title. E.g. '3-FixFormatting'

cd github-foo
git checkout -b 3-FixFormatting

โœ Note this not only creates the new branch, but also performs the checkout.

image

You can view all branches at any time using

git branch

This will also display the active branch.

image

At this point, you can yarn install if needed and make your changes to the project in your IDE.

Commit your changes

Start by checking the status of your changes. In this example a new file named OurScripts.js was created.

git status

image

You can see our new file is not tracked, so let's add it.

git add .

โœ Note we used the '.' wild card to add all our changes. You can instead use the file name to add one specific file.

Let's check the status again.

image

We see now that our new file is tracked and ready to be added to the commit.

Next we check the differences that our commit will include.

git diff --cached

image

๐Ÿ“ƒ The output of get diff and git log can sometimes be very long. You can break using 'Q'.

We see it will add one new file and displays the contents of that file.

๐Ÿคš If these changes are not what you want to commit, make your updates now and perform another yarn add . to update. Then check the status and differences again.

Everything looks good here, so let's commit.

git commit -m "commit message"

image

Looks like the commit was succesful, let's check the log.

git log

image

Looks good, but it is still only committed to local and we need it to go to origin. We can do this using the push command, the origin keyword, and the branch name.

git push origin 3-FixFormatting

image

Let's check the log again to see what changed.

image

We now see it's pointing to the 3-FixFormatting branch on origin. Now we can head to the repo on the GitHub website and create the PR.

image

After clicking Compare & Pull Request you can enter a new message and description for the Pull Request, and change which branch you will create the PR against. We're going to use the main branch.

In the description box, start by typing 'Fix #', this will open a list of Issues. Choose the appropriate open Issue here to link the Pull Request.

image

Also add any relevant screenshots, explanation videos, and a detailed write-up in the description box, then create the Pull Request.

image

Done! Now just keep an eye on your GitHub account for notifications of any comments or change requests on the Pull Request and respond or update as necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment