Skip to content

Instantly share code, notes, and snippets.

@DannyQuah
Last active April 5, 2025 12:16
Show Gist options
  • Save DannyQuah/5f43f9b75970bc4e357e42c7c9214b5d to your computer and use it in GitHub Desktop.
Save DannyQuah/5f43f9b75970bc4e357e42c7c9214b5d to your computer and use it in GitHub Desktop.

Revisions

  1. DannyQuah revised this gist Jan 12, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion 2020.05-D.Quah-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -65,7 +65,7 @@ $ git push myGist master # to gist

    Prosper.

    (As far as I have been able to tell `gists.github.com` continues to use `master` as the primary branch while since Oct 2020 `github.com` itself has switched to `main`.)
    (As far as I have been able to tell `gist.github.com` continues to use `master` as the primary branch while since Oct 2020 `github.com` itself has switched to `main`.)



  2. DannyQuah renamed this gist Jan 12, 2022. 1 changed file with 17 additions and 12 deletions.
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,24 @@
    **Managing Gists Locally**
    # Managing Gists Locally

    by Danny Quah, May 2020
    by Danny Quah, May 2020 (revised Jan 2022)

    Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (lines of code, images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.
    Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (lines of code, images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.

    Here's how to do this:
    Here's how to do this:

    Create the gist on GitHub and then clone it to your local filesystem:
    Create the gist on GitHub and then clone it to your local filesystem:

    ```
    $ git clone https://gist.github.com/DannyQuah/5f43f9b75970bc4e357e42c7c9214b5d
    ```

    Locally, rename that folder however you wish (or just leave it as that long string):
    Locally, rename that folder however you wish (or just leave it as that long string):

    ```
    $ mv -i 5f43f9b75970bc4e357e42c7c9214b5d localGistFolder
    $ mv -i 5f43f9b75970bc4e357e42c7c9214b5d YYYY.MM-Author-Subject
    ```

    Work on the file inside `localGistFolder/`; and then, whenever ready, as usual do:
    Work on the file inside `YYYY.MM-Author-Subject/`; and then, whenever ready, as usual do:

    ```
    $ # changes ...
    @@ -36,7 +36,7 @@ Using the feature that a git repo on the local filesystem can be associated with

    (In the sequel, anything that begins `my` should be named however the user prefers.)

    After the steps, above also create on GitHub a new git repo `myGistProject`; then from inside `localGistFolder/` add that new GitHub repo as a remote, labelling it `myGitHub` for git use, i.e.,
    After the steps, above also create on GitHub a new git repo `myGistProject`; then from inside `YYYY.MM-Author-Subject/` add that new GitHub repo as a remote, labelling it `myGitHub` for git use, i.e.,

    ```
    $ git remote add myGithub https://github.com/DannyQuah/myGistProject
    @@ -45,7 +45,7 @@ $ git remote add myGithub https://github.com/DannyQuah/myGistProject
    Push to the new repository on GitHub

    ```
    $ git push myGithub master
    $ git push myGithub main
    ```

    Keep things parallel by renaming the remote of the Gist snippet: `origin` is where this had come from, so now instead call it `myGist`
    @@ -59,12 +59,14 @@ Now each time push either to myGithub or myGist (or both, obviously):
    ```
    $ # changes
    $ git commit -m "The new changes"
    $ git push myGithub master # to github
    $ git push myGist master # to gist
    $ git push myGithub main # to github
    $ git push myGist master # to gist
    ```

    Prosper.

    (As far as I have been able to tell `gists.github.com` continues to use `master` as the primary branch while since Oct 2020 `github.com` itself has switched to `main`.)



    References:
    @@ -80,3 +82,6 @@ References:



    <!---
    Invisible section // Quah-D-2020.05-Managing-Gists-Locally.md
    -->
  3. DannyQuah revised this gist Jun 5, 2020. 1 changed file with 8 additions and 2 deletions.
    10 changes: 8 additions & 2 deletions Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -26,11 +26,17 @@ $ git commit -m "The new changes"
    $ git push
    ```

    Using the feature that a git repo on the local filesystem can be associated with multiple remotes on GitHub, it is possible also, alternatively and optionally, to get fancy by saving both a gist and a git repo on GitHub. Doing so follows [Ishu3101][].


    ### Putting the Gist on GitHub additionally

    You can leave this as above. But you can also get fancier.

    Using the feature that a git repo on the local filesystem can be associated with multiple remotes on GitHub, it is possible, alternatively and optionally, to save both a gist and a git repo on GitHub. Doing so follows [Ishu3101][].

    (In the sequel, anything that begins `my` should be named however the user prefers.)

    After the steps above also create on GitHub a new git repo `myGistProject`; then from inside `localGistFolder/` add that new GitHub repo as a remote, labelling it `myGitHub` for git use, i.e.,
    After the steps, above also create on GitHub a new git repo `myGistProject`; then from inside `localGistFolder/` add that new GitHub repo as a remote, labelling it `myGitHub` for git use, i.e.,

    ```
    $ git remote add myGithub https://github.com/DannyQuah/myGistProject
  4. DannyQuah revised this gist May 9, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    by Danny Quah, May 2020

    Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.
    Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (lines of code, images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.

    Here's how to do this:

  5. DannyQuah revised this gist May 9, 2020. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -42,7 +42,7 @@ Push to the new repository on GitHub
    $ git push myGithub master
    ```

    Keep things parallel by renaming the remote of gist; `origin` is where this had come from, so now instead called it `myGist`
    Keep things parallel by renaming the remote of the Gist snippet: `origin` is where this had come from, so now instead call it `myGist`

    ```
    $ git remote rename origin myGist
  6. DannyQuah revised this gist May 9, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -21,7 +21,7 @@ $ mv -i 5f43f9b75970bc4e357e42c7c9214b5d localGistFolder
    Work on the file inside `localGistFolder/`; and then, whenever ready, as usual do:

    ```
    $ # changes
    $ # changes ...
    $ git commit -m "The new changes"
    $ git push
    ```
    @@ -57,7 +57,7 @@ $ git push myGithub master # to github
    $ git push myGist master # to gist
    ```


    Prosper.



  7. DannyQuah revised this gist May 9, 2020. 1 changed file with 0 additions and 1 deletion.
    1 change: 0 additions & 1 deletion Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -68,7 +68,6 @@ References:



    Collection

    [Gisto]: https://www.gistoapp.com/
    [Ishu3101]: https://gist.github.com/ishu3101/830b556b487de5d69690
  8. DannyQuah revised this gist May 9, 2020. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,5 @@
    **Managing Gists Locally**

    by Danny Quah, May 2020

    Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.
  9. DannyQuah revised this gist May 9, 2020. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,4 @@
    Managing Gists Locally

    **Managing Gists Locally**
    by Danny Quah, May 2020

    Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.
  10. DannyQuah revised this gist May 9, 2020. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -9,13 +9,13 @@ Here's how to do this:
    Create the gist on GitHub and then clone it to your local filesystem:

    ```
    $ git clone https://gist.github.com/DannyQuah/091ed0cfbfee8a1ead01412f4735410b
    $ git clone https://gist.github.com/DannyQuah/5f43f9b75970bc4e357e42c7c9214b5d
    ```

    Locally, rename that folder however you wish (or just leave it as that long string):

    ```
    $ mv -i 091ed0cfbfee8a1ead01412f4735410b localGistFolder
    $ mv -i 5f43f9b75970bc4e357e42c7c9214b5d localGistFolder
    ```

    Work on the file inside `localGistFolder/`; and then, whenever ready, as usual do:
  11. DannyQuah created this gist May 9, 2020.
    77 changes: 77 additions & 0 deletions Quah-D-2020.05-Managing-Gists-Locally.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,77 @@
    Managing Gists Locally

    by Danny Quah, May 2020

    Through the Embed instruction or plugin, Gist snippets on GitHub can conveniently provide posts on Medium, WordPress, and elsewhere supplementary information (images, Markdown-created tables, and so on). But while Gist snippets on GitHub can be managed directly via browser or through something like [Gisto][], a user might also wish to manipulate them offline. This last is for many of the same reasons that a user seeks to clone a git repo to their local filesystem, modify it locally, and then only subsequently push changes back up to GitHub.

    Here's how to do this:

    Create the gist on GitHub and then clone it to your local filesystem:

    ```
    $ git clone https://gist.github.com/DannyQuah/091ed0cfbfee8a1ead01412f4735410b
    ```

    Locally, rename that folder however you wish (or just leave it as that long string):

    ```
    $ mv -i 091ed0cfbfee8a1ead01412f4735410b localGistFolder
    ```

    Work on the file inside `localGistFolder/`; and then, whenever ready, as usual do:

    ```
    $ # changes
    $ git commit -m "The new changes"
    $ git push
    ```

    Using the feature that a git repo on the local filesystem can be associated with multiple remotes on GitHub, it is possible also, alternatively and optionally, to get fancy by saving both a gist and a git repo on GitHub. Doing so follows [Ishu3101][].

    (In the sequel, anything that begins `my` should be named however the user prefers.)

    After the steps above also create on GitHub a new git repo `myGistProject`; then from inside `localGistFolder/` add that new GitHub repo as a remote, labelling it `myGitHub` for git use, i.e.,

    ```
    $ git remote add myGithub https://github.com/DannyQuah/myGistProject
    ```

    Push to the new repository on GitHub

    ```
    $ git push myGithub master
    ```

    Keep things parallel by renaming the remote of gist; `origin` is where this had come from, so now instead called it `myGist`

    ```
    $ git remote rename origin myGist
    ```

    Now each time push either to myGithub or myGist (or both, obviously):

    ```
    $ # changes
    $ git commit -m "The new changes"
    $ git push myGithub master # to github
    $ git push myGist master # to gist
    ```





    References:

    - [Gisto][]
    - [Ishu3101][]



    Collection

    [Gisto]: https://www.gistoapp.com/
    [Ishu3101]: https://gist.github.com/ishu3101/830b556b487de5d69690