Skip to content

GitHub

Created: 2017-03-23 10:51:31 -0700 Modified: 2023-12-07 08:42:10 -0800

It’s dead-simple to set up GitHub pages (~30 seconds from scratch). Just follow these instructions. Note that the repo either needs to be public or paid.

Protecting repos that I make public

Section titled Protecting repos that I make public

For streaming, I want to make sure that I don’t publish secrets, and if I do, someone else could potentially remove them before too many people see.

  • Keyboard shortcuts
    • gb: go to projects view
    • ⌃Space: make a new item
      • Preface the item with ”#” to choose a repo to create an issue in
  • If creating multiple issues at once, you can check “Create more” at the bottom of the dialog:
  • To add images, save the gist, paste the image into the comments for the gist, then copy the markdown that you get by doing that (reference)
  • To use gists for markdown, make sure the gist’s file is named “.md”

You can do this with commit hashes or tags.

As of 3/29/2019, this is not done through pull requests; if you have an “Edit” button, then you will just immediately save the results by pressing “Save Page”.

[14:37] EasyExperience: there’s no way to do PRs for wikis right now. That’s why some people just use a folder full of markdown files.

This is a browser extension that adds a bunch of features to GitHub.

”?” will always tell you the keyboard shortcuts for a particular page, so I’m just linking really helpful ones:

  • “L” when filing an issue will let you add a label. Note: I couldn’t figure out a fast way to get back to editing the issue text other than pressing shift+tab 6 times.

If you’re in a code view like this, hold shift while you click a line number in the gutter and you can select multiple.

For pages like this, managing the TOC can be really annoying. This will generate it for you as long as you’re not on Windows. :P

Note that to make a pull request, you have to fork the repo, then you typically make your own branch and submit the pull request through that. To make finding this particular fork and branch easier, there is this tool: https://github.com/jkup/pullit

The “hub” tool can also do this. See notes here.

I haven’t actually used this, so just copy/pasting something should I ever need it. The context is that this was advice around OpHog, but I couldn’t actually use GitHub pages since the artwork was licensed (and thus couldn’t be stored on GitHub):

9/11/17

3:33 HiDeoo: Adam13531 Just enable github page on the repo settings

3:33 HiDeoo: And serve index.html

3:33 HiDeoo: It’s free and give you an url

3:37 HiDeoo: Adam13531 Yeah, that’s what I used for https://hideoo.github.io/twitch-emotes-viewer/ it just serve the index.html from the repo. The only difference for you is that index.html is not on the root of the repo but in src so what you would want is not the serve the master branch but a new one called gh-pages and you would simply push the src folder in this branch with “git subtree push —prefix src origin gh-pages”

To get something like the image below:

  1. Open some code that you want to link to on GitHub.
  2. Press “Y” while looking at the code to get the canonical link, that way you’re not linking to Master. For example, this changes a link like https://github.com/lerna/lerna/blob/master/src/commands/ImportCommand.js#L74 into https://github.com/lerna/lerna/blob/34fd08aaac474693f8d9e0cc46bf22db862880ba/src/commands/ImportCommand.js#L74
  3. Paste the canonical link into an issue without Markup.
  4. Preview your comment to make sure it worked.

There’s a tool that can do this here: https://github.com/ekalinin/github-markdown-toc

Note: this technically works for any markdown, not just on GitHub

Suppose you want to link to an image or code from a JSFiddle:

HiDeoo Adam13531 I think it’s https://raw.githubusercontent.com/username/repo/file

HiDeoo Which you can transform in https://cdn.rawgit.com/username/repo/file

HiDeoo Or you can use their website https://rawgit.com/

Browsing the repository at a particular point in history

Section titled Browsing the repository at a particular point in history

Suppose you want to see what all files looked like at a particular commit and not just the changed files for that commit:

If you click “Branches” as shown below, you’ll get UI that will let you delete branches:

You can’t delete protected branches, so you’ll have to go into the repository’s settings to “unprotect” those branches first (I did this by changing “Apply rule to *” to “Apply rule to AAA” just to undo it temporarily, but that’s because no one else is pushing code for Bot Land).

If you ever want to make a change to someone else’s repository in such a way that they can easily merge it back into their codebase, do these steps:

Full steps:

  • Fork the repo
  • Clone the repo locally
  • Make a new branch on the forked repo
    • This is because new changes are committed to the PR as well, so you typically want to make a new branch that you can sort of “freeze” for the sake of a PR.
  • Make changes on this new branch
  • Commit and push (no need to merge)
  • On GitHub, refresh your repo and you should see your change with a “Compare and pull request” button next to it (if not, just go to “new pull request” from the main repo and choose “compare across forks” to be able to see your fork). Click that. Make sure to pick the source branch and the destination branch correctly.

Note: any new pushes you do to that branch will automatically update the PR.

Simple steps:

  • Go to a file in their GitHub and click the “Edit” button.

If you did the above steps WITHOUT step #2 (“clone the repo locally”) and you instead cloned the original repo, you can just change the remote of the cloned repo to point at your fork, then continue to push as normal.

Just say “fixes #123” or “closes #123” in your pull request, even in the description.

[15:57] HiDeoo: If you want that, a function I wrote to alias git to hub + auto cd after cloning a repo https://bpaste.net/show/4c7e18d249ae

Add “?w=1” to the URL.

Note: this is no longer a secret

Press the “close laptop”-lookin’ button at the bottom or top: