3These scripts are all shortcuts for using [Git], mostly designed to let me do my common Git tasks with as little typing as possible.
5[
Git]:
https://git-scm.com/
7## The individual scripts
11# This adds the root of the repo to the PATH, which has cog_helpers.py
12from os.path import abspath, dirname
15sys.path.append(abspath(dirname(dirname("."))))
23 "variants": ["bad", "good"],
25 alias for <a href="https://git-scm.com/docs/git-bisect"><code>git bisect bad / good</code></a>
29 "name": "cleanup_branches",
31 clean up any local branches which have been merged into the primary branch (<code>main</code>, <code>master</code>, etc.)
37 alias for <a href="https://git-scm.com/docs/git-checkout"><code>git checkout -b [name]</code></a>, which creates a new branch
43 alias for <a href="https://git-scm.com/docs/git-checkout"><code>git checkout</code></a>, which switches to the given branch
49 <strong>g</strong>et the name of the <strong>c</strong>urrent <strong>b</strong>ranch
55 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
61 print a brief line count summary of my local Git changes (any staged and uncommitted changes)
65 --- 57 deletions</code></pre>
72 switch to the primary branch (usually <code>main</code>, hence <code>gm</code>) and pull any changes from the remote server
78 <strong>p</strong>ull any changes on the current branch from the remote server
84 open a GitHub <strong>p</strong>ull <strong>r</strong>equest for the current branch
90 alias for <code>git rev-parse --show-toplevel</code>, which prints the root of the current repository
96 open the current Git repo in my web browser (assuming it's a GitHub repo)
102 open the current Git repo in <a href="https://gitup.co/">GitUp</a>, my GUI Git client of choice
107cog_helpers.create_description_table(folder_name=folder_name, scripts=scripts)
112 <a href="https://github.com/alexwlchan/scripts/blob/main/git/bad">
116 <a href="https://github.com/alexwlchan/scripts/blob/main/git/good">
121 alias for <a href="https://git-scm.com/docs/git-bisect"><code>git bisect bad / good</code></a>
125 <a href="https://github.com/alexwlchan/scripts/blob/main/git/cleanup_branches">
126 <code>cleanup_branches</code>
130 clean up any local branches which have been merged into the primary branch (<code>main</code>, <code>master</code>, etc.)
134 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gb">
135 <code>gb [name]</code>
139 alias for <a href="https://git-scm.com/docs/git-checkout"><code>git checkout -b [name]</code></a>, which creates a new branch
143 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gc">
144 <code>gc [name]</code>
148 alias for <a href="https://git-scm.com/docs/git-checkout"><code>git checkout</code></a>, which switches to the given branch
152 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gcb">
157 <strong>g</strong>et the name of the <strong>c</strong>urrent <strong>b</strong>ranch
161 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gf">
166 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
170 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gitstats">
171 <code>gitstats</code>
175 print a brief line count summary of my local Git changes (any staged and uncommitted changes)
177 <pre><code>$ gitstats
179 --- 57 deletions</code></pre>
184 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gm">
189 switch to the primary branch (usually <code>main</code>, hence <code>gm</code>) and pull any changes from the remote server
193 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gp">
198 <strong>p</strong>ull any changes on the current branch from the remote server
202 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gpr">
207 open a GitHub <strong>p</strong>ull <strong>r</strong>equest for the current branch
211 <a href="https://github.com/alexwlchan/scripts/blob/main/git/groot">
216 alias for <code>git rev-parse --show-toplevel</code>, which prints the root of the current repository
220 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gub">
225 open the current Git repo in my web browser (assuming it's a GitHub repo)
229 <a href="https://github.com/alexwlchan/scripts/blob/main/git/gup">
234 open the current Git repo in <a href="https://gitup.co/">GitUp</a>, my GUI Git client of choice
237<!-- [[[end]]] (sum: vSOg0LYPZG) -->