<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Git on Jake Worth</title><link>https://jakeworth.com/tags/git/</link><description>Recent content in Git on Jake Worth</description><image><title>Jake Worth</title><url>https://jakeworth.com/twittercard.png</url><link>https://jakeworth.com/twittercard.png</link></image><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 27 Feb 2026 16:51:25 -0500</lastBuildDate><atom:link href="https://jakeworth.com/tags/git/index.xml" rel="self" type="application/rss+xml"/><item><title>Git Apply Diff</title><link>https://jakeworth.com/tils/git-apply-diff/</link><pubDate>Fri, 27 Feb 2026 16:51:25 -0500</pubDate><guid>https://jakeworth.com/tils/git-apply-diff/</guid><description>&lt;p&gt;One of my favorite Git tricks is shoveling changes to a Git diff and then applying them later.&lt;/p&gt;</description></item><item><title>Things I Check Before Opening a PR</title><link>https://jakeworth.com/posts/things-i-check-before-opening-a-pr/</link><pubDate>Sat, 07 Feb 2026 14:58:34 -0500</pubDate><guid>https://jakeworth.com/posts/things-i-check-before-opening-a-pr/</guid><description>&lt;p&gt;What is a programmer but a series of PRs (pull requests)? I optimize PRs to
introduce the best code I can, be easy to review, and document my work so I can
make sense of it in the future. Here are some things I always check before
opening a PR.&lt;/p&gt;</description></item><item><title>Git Porcelain and Plumbing 🚽</title><link>https://jakeworth.com/tils/git-porcelain-and-plumbing/</link><pubDate>Mon, 26 Jan 2026 16:53:11 -0500</pubDate><guid>https://jakeworth.com/tils/git-porcelain-and-plumbing/</guid><description>&lt;p&gt;Git has two kinds of commands: &amp;ldquo;porcelain&amp;rdquo; and &amp;ldquo;plumbing&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Timestamped Branch</title><link>https://jakeworth.com/tils/timestamped-branch/</link><pubDate>Thu, 20 Nov 2025 16:53:29 -0500</pubDate><guid>https://jakeworth.com/tils/timestamped-branch/</guid><description>&lt;p&gt;Git prevents branches with the same name. But sometimes, I want to re-use a name! Here&amp;rsquo;s my workaround.&lt;/p&gt;</description></item><item><title>Why Keep Binaries Out of Version Control</title><link>https://jakeworth.com/tils/why-keep-binaries-out-of-version-control/</link><pubDate>Thu, 20 Nov 2025 10:48:23 -0500</pubDate><guid>https://jakeworth.com/tils/why-keep-binaries-out-of-version-control/</guid><description>&lt;p&gt;&amp;ldquo;Keep binaries out of version control&amp;rdquo; is a truth I&amp;rsquo;ve always held, but I recently learned more about why.&lt;/p&gt;</description></item><item><title>"Don't Stay Stuck" Digital Guide Launch</title><link>https://jakeworth.com/posts/dont-stay-stuck-digital-guide-launch/</link><pubDate>Tue, 12 Aug 2025 09:33:04 -0400</pubDate><guid>https://jakeworth.com/posts/dont-stay-stuck-digital-guide-launch/</guid><description>&lt;p&gt;I&amp;rsquo;m proud to announce the launch of my digital guide to software debugging, &lt;a href="https://jwworth.gumroad.com/l/dont-stay-stuck"&gt;Don&amp;rsquo;t Stay Stuck: A Debugging Guide for Rising Engineers&lt;/a&gt;!&lt;/p&gt;</description></item><item><title>Git Apply a Commit in Reverse</title><link>https://jakeworth.com/tils/git-apply-a-commit-in-reverse/</link><pubDate>Wed, 30 Jul 2025 14:48:55 -0400</pubDate><guid>https://jakeworth.com/tils/git-apply-a-commit-in-reverse/</guid><description>&lt;p&gt;Sometimes I&amp;rsquo;ll be looking at a Git commit online, and want to put my dev environment in a world where the commit is un-applied. This can be achieved by applying it in reverse.&lt;/p&gt;</description></item><item><title>Show How A File Is Ignored In Git</title><link>https://jakeworth.com/tils/show-how-a-file-is-ignored-in-git/</link><pubDate>Fri, 31 May 2024 10:21:44 -0400</pubDate><guid>https://jakeworth.com/tils/show-how-a-file-is-ignored-in-git/</guid><description>&lt;p&gt;Today I solved a mystery: a file was being Git-ignored in a new project that didn&amp;rsquo;t have a
&lt;code&gt;.gitignore&lt;/code&gt;. Here&amp;rsquo;s me learning this by trying and failing to add it:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ git add destroy.sh
The following paths are ignored by one of your .gitignore files:
destroy.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;This output tells me some &lt;code&gt;.gitignore&lt;/code&gt; is telling Git to ignore my script. Another way to confirm this is the &lt;code&gt;check-ignore&lt;/code&gt; command:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ git check-ignore destroy.sh
destroy.sh
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The output here is the match; a file named &lt;code&gt;destroy.sh&lt;/code&gt; is indeed being ignored. But how? We can answer that question
with the &lt;code&gt;-v&lt;/code&gt; flag:&lt;/p&gt;</description></item><item><title>Apply a Patch in Reverse</title><link>https://jakeworth.com/tils/apply-a-patch-in-reverse/</link><pubDate>Fri, 24 Mar 2023 09:11:39 -0400</pubDate><guid>https://jakeworth.com/tils/apply-a-patch-in-reverse/</guid><description>&lt;p&gt;Need to undo a code change? You could revert. Or, you could apply the patch
without creating a commit. That&amp;rsquo;s what I want to do much of the time.&lt;/p&gt;
&lt;p&gt;Use &lt;code&gt;git apply&lt;/code&gt; with the &lt;code&gt;-R&lt;/code&gt; (reverse) flag:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git show 8cc13b1 | git apply -R
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;All the changes from &lt;code&gt;8cc13b1&lt;/code&gt; get applied to your working directory. In a large commit,
do this tactically by limiting to just one file or directory.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git show 8cc13b1 src/fileToRevert.ts | git apply -R
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>How to Identify the Breaking Commit With Git Bisect</title><link>https://jakeworth.com/posts/find-the-breaking-git-commit/</link><pubDate>Tue, 17 May 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/find-the-breaking-git-commit/</guid><description>&lt;p&gt;Some code is broken, and you can&amp;rsquo;t figure out why. Maybe there are a lot of changes, and identifying the breaking change seems impossible. Or, maybe you&amp;rsquo;re curious about how things break in your organization. The tool you need is &lt;code&gt;git-bisect&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Commit Part of a File in Git</title><link>https://jakeworth.com/posts/commit-part-of-a-file-in-git/</link><pubDate>Fri, 06 May 2022 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/commit-part-of-a-file-in-git/</guid><description>&lt;p&gt;You&amp;rsquo;ve been working on a big set of changes, and haven&amp;rsquo;t committed to Git yet.
Now, you want to commit some, but not all, changes to a file. Let&amp;rsquo;s look
at adding patches.&lt;/p&gt;</description></item><item><title>Force with Lease</title><link>https://jakeworth.com/tils/force-with-lease/</link><pubDate>Fri, 05 Nov 2021 21:21:44 -0400</pubDate><guid>https://jakeworth.com/tils/force-with-lease/</guid><description>&lt;p&gt;When I rebase, I force-push altered history using the flag &lt;code&gt;--force-with-lease&lt;/code&gt;
instead of the commonly-used &lt;code&gt;--force&lt;/code&gt;.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git push --force-with-lease
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;But why? This is a TIL for me because I&amp;rsquo;ve used this command for years without
reading the docs.&lt;/p&gt;
&lt;p&gt;Take it away, docs:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;This option allows you to say that you expect the history you are updating is
what you rebased and want to replace. If the remote ref still points at the
commit you specified, you can be sure that no other people did anything to
the ref.&lt;/p&gt;</description></item><item><title>Duplicate your Development Branch for QA</title><link>https://jakeworth.com/posts/duplicate-your-developent-branch-for-qa/</link><pubDate>Fri, 09 Oct 2020 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/duplicate-your-developent-branch-for-qa/</guid><description>&lt;p&gt;I&amp;rsquo;m working on a team where we keep a clone of the &lt;code&gt;development&lt;/code&gt; branch (the main
place where work is done), used to deploy to a QA environment. The benefits of
this branching technique are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;clone&lt;/code&gt; is isolated from work&lt;/li&gt;
&lt;li&gt;It&amp;rsquo;s easy to tell what was deployed to QA– &lt;code&gt;clone&lt;/code&gt; is the source of truth&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Porting TIL from Rails to Phoenix: Initial Commits</title><link>https://jakeworth.com/posts/porting-til-to-phoenix-initial-commits/</link><pubDate>Tue, 29 Nov 2016 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/porting-til-to-phoenix-initial-commits/</guid><description>&lt;p&gt;Last week, I started a new project: porting &lt;a href="https://til.hashrocket.com"&gt;Today I
Learned&lt;/a&gt; from Ruby on Rails to Phoenix (Elixir).&lt;/p&gt;</description></item><item><title>How and Why to Squash Your Pull Request</title><link>https://jakeworth.com/posts/squash-your-pr/</link><pubDate>Sun, 03 Jul 2016 00:00:00 +0000</pubDate><guid>https://jakeworth.com/posts/squash-your-pr/</guid><description>&lt;p&gt;Many pull requests go through a cycle: programmer opens pull request,
maintainer gives feedback, programmer makes changes, repeat until ready to
merge, maintainer merges. Prior to the merge, the pull request can be messy,
full of reverts, fixups, and WIP commits. In the end, those commits are noise.
We can tell a better story by squashing the branch.&lt;/p&gt;</description></item><item><title>Delete Remote Git Tags</title><link>https://jakeworth.com/tils/delete-remote-git-tags/</link><pubDate>Fri, 18 Mar 2016 14:18:40 -0500</pubDate><guid>https://jakeworth.com/tils/delete-remote-git-tags/</guid><description>&lt;p&gt;Tagging releases with Git is a good idea. In case your tags get off track, here is how you delete a Git tag locally and on a remote:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ git tag -d abc
$ git push origin :refs/tags/abc
To git@github.com:hashrocket/hr-til
- [deleted] abc
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;It gets trickier if you&amp;rsquo;re using Semantic Versioning, which includes dots in the tag name. The above won&amp;rsquo;t work for &lt;code&gt;v16.0.0&lt;/code&gt;. This will:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ git tag -d v16.0.0
$ git push origin :v16.0.0
To git@github.com:hashrocket/hr-til
- [deleted] v16.0.0
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Git Log With Authors</title><link>https://jakeworth.com/tils/git-log-with-authors/</link><pubDate>Thu, 25 Feb 2016 13:29:59 -0600</pubDate><guid>https://jakeworth.com/tils/git-log-with-authors/</guid><description>&lt;p&gt;In my &lt;a href="https://til.hashrocket.com/posts/32d01c979e-git-log-since"&gt;never-ending quest&lt;/a&gt; to better summarize my work at the end of the day using computers, I discovered today the Git &lt;code&gt;--author&lt;/code&gt; flag. It works like this:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ glg --since=midnight --author=dev+jwworth+mikechau@hashrocket.com
* 4ba91a8 (HEAD, origin/checkout, checkout) Add guard for manual entry of employee discount
* 3a4e4c9 Seed a coupon and code and auto-apply in preview
* cb1adee Add discount
...
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;The alias &lt;code&gt;glg&lt;/code&gt; is discussed &lt;a href="https://til.hashrocket.com/posts/32d01c979e-git-log-since"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;I use this when multiple developers or teams are committing throughout the day to the same repository, to disambiguate our work from others. Ready to paste into your billing software of choice.&lt;/p&gt;</description></item><item><title>The Alpha Commit</title><link>https://jakeworth.com/tils/the-alpha-commit/</link><pubDate>Wed, 21 Oct 2015 11:24:53 -0500</pubDate><guid>https://jakeworth.com/tils/the-alpha-commit/</guid><description>&lt;p&gt;I like to read commit logs.&lt;/p&gt;
&lt;p&gt;Today I wanted to see the first commit on a project. Here&amp;rsquo;s what I used:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git rev-list --max-parents=0 HEAD
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;&lt;em&gt;Show me the commits that led to&lt;/em&gt; &lt;code&gt;HEAD&lt;/code&gt; &lt;em&gt;in reverse chronological order; then limit that list to the commits with no parent.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s a small modification, to show the entire commit rather than the SHA alone:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git show $(git rev-list --max-parents=0 HEAD)
&lt;/code&gt;&lt;/pre&gt;</description></item><item><title>Git Log since</title><link>https://jakeworth.com/tils/git-log-since/</link><pubDate>Tue, 29 Sep 2015 17:42:09 -0500</pubDate><guid>https://jakeworth.com/tils/git-log-since/</guid><description>&lt;p&gt;At the end of each day, I try to record what I did, to jog my memory during the next morning&amp;rsquo;s standup. This is a helpful aid:&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;git log --since=&amp;#34;24 hours ago&amp;#34;
&lt;/code&gt;&lt;/pre&gt;&lt;p&gt;I SSH into my work machine and run this in my project&amp;rsquo;s root directory. Combined with an alias from the Hashrocket Dotmatrix, &lt;code&gt;glg&lt;/code&gt; (&lt;code&gt;git log --graph --oneline --decorate --color --all&lt;/code&gt;), I get a terse summary of the day&amp;rsquo;s work, ready to be pasted into your note-taking or project management tool of choice:&lt;/p&gt;</description></item><item><title>Git Snapshot</title><link>https://jakeworth.com/tils/git-snapshot/</link><pubDate>Fri, 08 May 2015 12:33:10 -0400</pubDate><guid>https://jakeworth.com/tils/git-snapshot/</guid><description>&lt;p&gt;To save a snapshot of your current work in git, try this command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-shell" data-lang="shell"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;git stash save &lt;span style="color:#e6db74"&gt;&amp;#34;snapshot: &lt;/span&gt;&lt;span style="color:#66d9ef"&gt;$(&lt;/span&gt;date&lt;span style="color:#66d9ef"&gt;)&lt;/span&gt;&lt;span style="color:#e6db74"&gt;&amp;#34;&lt;/span&gt; &lt;span style="color:#f92672"&gt;&amp;amp;&amp;amp;&lt;/span&gt; git stash apply &lt;span style="color:#e6db74"&gt;&amp;#34;stash@{0}&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This saves your current work in a timestamped stash, without removing it. In Hashrocket&amp;rsquo;s dotmatrix this command is aliased to &lt;code&gt;git snapshot&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Undo a Git Mistake</title><link>https://jakeworth.com/tils/undo-a-git-mistake/</link><pubDate>Tue, 21 Apr 2015 15:25:51 -0400</pubDate><guid>https://jakeworth.com/tils/undo-a-git-mistake/</guid><description>&lt;p&gt;&lt;code&gt;git reflog&lt;/code&gt; is a record of your actions in Git. With this command, you can undo almost any Git mistake.&lt;/p&gt;
&lt;pre tabindex="0"&gt;&lt;code&gt;$ git reflog
4bd0090 HEAD@{0}: &amp;lt;bad place&amp;gt;
46bd839 HEAD@{1}: &amp;lt;bad place&amp;gt;
967e214 HEAD@{2}: &amp;lt;last good place&amp;gt;
46bd839 HEAD@{3}: &amp;lt;good place&amp;gt;
967e214 HEAD@{4}: &amp;lt;good place&amp;gt;
$ git reset --hard HEAD@{2}
&lt;/code&gt;&lt;/pre&gt;</description></item></channel></rss>