20 Git Commands you (probably) didn't know about
Tags: git
Published: 2022-12-23 04:59:40

<!-- wp:paragraph -->
<p>If you've ever browsed the&nbsp;<a href="https://git-scm.com/docs">git manual</a>&nbsp;(or run&nbsp;<code>man git</code>), then you'll have noticed there's a whole lot more to git than what most of us use on a daily basis. A lot of these commands are incredibly powerful and can make your life a lot easier (others are a bit niche, but still good to know).</p>
<!-- /wp:paragraph -->

<!-- wp:quote -->
<blockquote class="wp-block-quote"><!-- wp:paragraph -->
<p>This post outlines 20 of my favourite under-used git features, which you can use to level up your development process, impress your colleagues, help you answer git interview questions, and most importantly - have fun with! </p>
<!-- /wp:paragraph --></blockquote>
<!-- /wp:quote -->

<!-- wp:paragraph -->
<p><em>Discover: <a href="https://www.codelivly.com/super-useful-css-resources/">Super Useful CSS Resources</a></em></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>Here are 20 Git commands that you may not be familiar with:</p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li><code>git stash</code> - This command allows you to temporarily save changes that are not ready to be committed, and switch to a different branch. You can later reapply the changes with <code>git stash apply</code>.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git stash list</code> - This command lists all of the stashes that you have saved with <code>git stash</code>.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git stash show</code> - This command shows the changes that are contained in a specific stash.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git stash drop</code> - This command removes a specific stash from the stash list.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git stash clear</code> - This command removes all stashes from the stash list.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git cherry-pick</code> - This command allows you to apply a specific commit from one branch to another. </li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><em>Discover: <a href="https://www.codelivly.com/20-javascript-concepts-every-developer-should-know/">20 JavaScript Concepts Every Developer Should Know</a></em></p>
<!-- /wp:paragraph -->

<!-- wp:list {"ordered":true} -->
<ol><!-- wp:list-item -->
<li><code>git rebase</code> - This command allows you to reapply commits on top of another base tip.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git bisect</code> - This command helps you find the commit that introduced a bug by performing a binary search through the commit history.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git blame</code> - This command shows you the last person to modify each line in a file, along with the commit that made the change.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git grep</code> - This command allows you to search for a pattern within your repository.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git shortlog</code> - This command shows a summary of commits grouped by author.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git describe</code> - This command shows a human-readable description of a commit, based on the closest tag.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git show-branch</code> - This command shows a summary of branches and their commits.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git log --graph</code> - This command shows a visual representation of your commit history, with branches and merges.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git clean</code> - This command removes untracked files from your repository.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git submodule</code> - This command allows you to include other Git repositories within your repository as subdirectories.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git stash branch</code> - This command creates a new branch from your stash, and removes the stash.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git cherry</code> - This command shows a list of commits that are in one branch, but not in another.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git ls-files</code> - This command lists all of the files in your repository.</li>
<!-- /wp:list-item -->

<!-- wp:list-item -->
<li><code>git merge --squash</code> - This command merges multiple commits into a single commit, without creating a merge commit. </li>
<!-- /wp:list-item --></ol>
<!-- /wp:list -->

<!-- wp:paragraph -->
<p><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">Follow Us On </mark>: <a href="http://instagram.com/codelivly">Instagram</a>.... <a href="http://twitter.com/codelivly">Twitter </a>.... <a href="http://facebook.com/codelivly">Facebook</a>.... <a href="https://t.me/codelivly">Telegram</a> .... <a href="https://www.codelivly.com">Website</a></strong></p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>I hope these Git commands are useful to you! Let me know if you have any questions. </p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p><em>Discover: <a href="https://www.codelivly.com/why-do-programmer-care-about-set-theory/">Why do Programmer Care About Set Theory</a></em></p>
<!-- /wp:paragraph -->