Skip to main content

Use Cog to document my Git scripts

ID
a664799
date
2023-12-26 22:53:02+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
4b5d7e4
message
Use Cog to document my Git scripts
changed files
1 file, 110 additions, 6 deletions

Changed files

git/README.md (3637) → git/README.md (6678)

diff --git a/git/README.md b/git/README.md
index 33f0bd9..7fbafaf 100644
--- a/git/README.md
+++ b/git/README.md
@@ -6,11 +6,114 @@ These scripts are all shortcuts for using [Git], mostly designed to let me do my
 
 ## The individual scripts
 
+<!-- [[[cog
+
+# This adds the root of the repo to the PATH, which has cog_helpers.py
+from os.path import abspath, dirname
+import sys
+
+sys.path.append(abspath(dirname(dirname("."))))
+
+import cog_helpers
+
+folder_name = "git"
+
+scripts = [
+    {
+        "variants": ["bad", "good"],
+        "description": """
+        alias for <a href="https://git-scm.com/docs/git-bisect"><code>git bisect bad / good</code></a>
+        """
+    },
+    {
+        "name": "cleanup_branches",
+        "description": """
+        clean up any local branches which have been merged into the primary branch (<code>main</code>, <code>master</code>, etc.)
+        """
+    },
+    {
+        "name": "find_big_commits",
+        "description": """
+        print some information about the biggest files/commits in the Git history.
+        """
+    },
+    {
+        "usage": "gb [name]",
+        "description": """
+        alias for <a href="https://git-scm.com/docs/git-checkout"><code>git checkout -b [name]</code></a>, which creates a new branch
+        """
+    },
+    {
+        "usage": "gc [name]",
+        "description": """
+        alias for <a href="https://git-scm.com/docs/git-checkout"><code>git checkout</code></a>, which switches to the given branch
+        """
+    },
+    {
+        "usage": "gcb",
+        "description": """
+        <strong>g</strong>et the name of the <strong>c</strong>urrent <strong>b</strong>ranch
+        """
+    },
+    {
+        "usage": "gf",
+        "description": """
+        alias for <a href="https://git-scm.com/docs/git-checkout"><code>git fetch origin --prune</code></a>, which gets updated information about all the branches on the remote server
+        """
+    },
+    {
+        "usage": "gitstats",
+        "description": """
+        print a brief line count summary of my local Git changes (any staged and uncommitted changes)
+        <p>
+        <pre><code>$ gitstats
+    +++  0 additions
+    --- 57 deletions</code></pre>
+        </p>
+        """
+    },
+    {
+        "usage": "gm",
+        "description": """
+        switch to the primary branch (usually <code>main</code>, hence <code>gm</code>) and pull any changes from the remote server
+        """
+    },
+    {
+        "usage": "gp",
+        "description": """
+        <strong>p</strong>ull any changes on the current branch from the remote server
+        """
+    },
+    {
+        "usage": "groot",
+        "description": """
+        alias for <code>git rev-parse --show-toplevel</code>, which prints the root of the current repository
+        """
+    },
+    {
+        "usage": "gub",
+        "description": """
+        open the current Git repo in my web browser (assuming it's a GitHub repo)
+        """
+    },
+    {
+        "usage": "gup",
+        "description": """
+        open the current Git repo in <a href="https://gitup.co/">GitUp</a>, my GUI Git client of choice
+        """
+    },
+]
+
+cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
+
+]]]-->
 <dl>
   <dt>
     <a href="https://github.com/alexwlchan/scripts/blob/main/git/bad">
       <code>bad</code>
-    </a> / <a href="https://github.com/alexwlchan/scripts/blob/main/git/good">
+    </a>
+/
+    <a href="https://github.com/alexwlchan/scripts/blob/main/git/good">
       <code>good</code>
     </a>
   </dt>
@@ -79,11 +182,11 @@ These scripts are all shortcuts for using [Git], mostly designed to let me do my
   </dt>
   <dd>
     print a brief line count summary of my local Git changes (any staged and uncommitted changes)
-    <p>
-    <pre><code>$ gitstats
-+++  0 additions
---- 57 deletions</code></pre>
-    </p>
+        <p>
+        <pre><code>$ gitstats
+    +++  0 additions
+    --- 57 deletions</code></pre>
+        </p>
   </dd>
 
   <dt>
@@ -131,3 +234,4 @@ These scripts are all shortcuts for using [Git], mostly designed to let me do my
     open the current Git repo in <a href="https://gitup.co/">GitUp</a>, my GUI Git client of choice
   </dd>
 </dl>
+<!-- [[[end]]] (checksum: 2231bc7f77bf967a1fc30100e3701c44) -->