<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-ypmpuwb45" -->

---
title: Mastering Git: 13 Advanced Techniques and Shortcuts for...
description: Learn advanced techniques and shortcuts for Git to enhance your development workflow and productivity. Topics covered include combining add and commit,...
canonical: https://daily.dev/posts/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-ypmpuwb45
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Mastering Git: 13 Advanced Techniques and Shortcuts for Efficiency | daily.dev
og:description: Learn advanced techniques and shortcuts for Git to enhance your development workflow and productivity. Topics covered include combining add and commit,...
og:url: https://daily.dev/posts/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-ypmpuwb45
og:image: https://api.daily.dev/og/posts/ypMPuWB45.png
og:image:alt: Mastering Git: 13 Advanced Techniques and Shortcuts for Efficiency
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Mastering Git: 13 Advanced Techniques and Shortcuts for Efficiency

**[DEV](https://daily.dev/sources/devto)** · 3 min read · 467 upvotes · 12 comments

## Summary

Learn advanced techniques and shortcuts for Git to enhance your development workflow and productivity. Topics covered include combining add and commit, creating aliases for Git commands, amending commit messages, force pushing, reverting changes, using Codespaces, stashing changes, renaming the main branch, viewing pretty logs, debugging with bisect, automating commit consolidation with autosquash, leveraging hooks for custom scripts, and safely destroying things in Git history.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://dev.to/anjankarmakar/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-10d1>

## Community discussion

Top comments from developers on daily.dev.

**@orcdev** · 16 upvotes

> When I saw the post I was wondering what is Git 13 :D

**@andrescaro16** · 5 upvotes

> Excellent post! I leave here my contribution:
>
> For improving the logs we can use: `git tree`
>
> ...after creating that alias with the command: `git config --global alias.tree "log --graph --abbrev-commit --decorate --format=format:'%C(magenta)%h%C(reset) - %C(bold green)(%ar) - %C(reset)%C(white)%s%C(reset)%C(bold blue) - %an%C(reset) %C(bold yellow)%d%C(reset)' --all --date=relative"`
>
>
> And if you would like to know more commands here you can: [github.com/andrescaro16/Comandos-Git-GitHub](https://github.com/andrescaro16/Comandos-Git-GitHub)

**@visnusah** · 2 upvotes

> An abundance of valuable information on creating aliases for git commands.

**@sergiorodrigues** · 1 upvotes

> Awesome Post! Learnt some good tricks :)

**@tonciz** · 0 upvotes

> Oh nice I'll be using ```git checkout -```, I'm usually working on 2 branches

---

Tags: [#devtools](https://daily.dev/tags/devtools), [#git](https://daily.dev/tags/git), [#github](https://daily.dev/tags/github), [#open-source](https://daily.dev/tags/open-source), [#productivity](https://daily.dev/tags/productivity), [#version-control](https://daily.dev/tags/version-control)

[View this post on daily.dev](https://daily.dev/posts/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-ypmpuwb45)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Mastering Git: 13 Advanced Techniques and Shortcuts for Efficiency","url":"https://daily.dev/posts/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-ypmpuwb45","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-ypmpuwb45"},"datePublished":"2024-05-10T23:04:12.857Z","dateModified":"2026-03-15T03:27:20.850Z","description":"Learn advanced techniques and shortcuts for Git to enhance your development workflow and productivity. Topics covered include combining add and commit,...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8cd606486c68a7dc9ada38994e712d17?_a=AQAEuiZ","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/8cd606486c68a7dc9ada38994e712d17?_a=AQAEuiZ","isAccessibleForFree":true,"articleSection":"DEV","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"DEV","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/devto","url":"https://daily.dev/sources/devto"},"commentCount":12,"discussionUrl":"https://daily.dev/posts/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-ypmpuwb45","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":467},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":12}],"keywords":"devtools,git,github,open-source,productivity,version-control","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"DEV","item":"https://daily.dev/sources/devto"},{"@type":"ListItem","position":3,"name":"Mastering Git: 13 Advanced Techniques and Shortcuts for Efficiency"}]}
{"@context":"https://schema.org","@type":"WebPage","@id":"https://daily.dev/posts/mastering-git-13-advanced-techniques-and-shortcuts-for-efficiency-ypmpuwb45","comment":[{"@type":"Comment","text":"When I saw the post I was wondering what is Git 13 :D","datePublished":"2024-05-12T09:22:42.415Z","url":"https://daily.dev/posts/ypMPuWB45#c-aDasv57bw","author":{"@type":"Person","name":"OrcDev","url":"https://daily.dev/orcdev","image":"https://avatars.githubusercontent.com/u/7549148?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":16}},{"@type":"Comment","text":"Excellent post! I leave here my contribution:\nFor improving the logs we can use: git tree\n…after creating that alias with the command: git config --global alias.tree &quot;log --graph --abbrev-commit --decorate --format=format:'%C(magenta)%h%C(reset) - %C(bold green)(%ar) - %C(reset)%C(white)%s%C(reset)%C(bold blue) - %an%C(reset) %C(bold yellow)%d%C(reset)' --all --date=relative&quot;\nAnd if you would like to know more commands here you can: github.com/andrescaro16/Comandos-Git-GitHub","datePublished":"2024-05-14T19:23:34.059Z","url":"https://daily.dev/posts/ypMPuWB45#c-p3TYn1TjN","author":{"@type":"Person","name":"Andrés Julian Caro Restrepo","url":"https://daily.dev/andrescaro16","image":"https://avatars.githubusercontent.com/u/88978612?v=4"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":5}},{"@type":"Comment","text":"An abundance of valuable information on creating aliases for git commands.","datePublished":"2024-05-30T18:56:55.016Z","url":"https://daily.dev/posts/ypMPuWB45#c-gj6tG7xrh","author":{"@type":"Person","name":"Visnu Sah","url":"https://daily.dev/visnusah","image":"https://media.daily.dev/image/upload/s--7Eb2VhZA--/f_auto/v1713496901/avatars/avatar_0aodCDkI5UPAjmW65chRV"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":2}},{"@type":"Comment","text":"Awesome Post! Learnt some good tricks :)","datePublished":"2024-06-07T23:23:42.900Z","url":"https://daily.dev/posts/ypMPuWB45#c-O9yPGkW6O","author":{"@type":"Person","name":"Sergio Rodrigues","url":"https://daily.dev/sergiorodrigues","image":"https://lh3.googleusercontent.com/a/ACg8ocLwifDED3q7QfrNWyalLb3_S05F14DeQBxwqGLD0NWzPaLF6Fw=s96-c"},"interactionStatistic":{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":1}},{"@type":"Comment","text":"Oh nice I’ll be using git checkout -, I’m usually working on 2 branches","datePublished":"2024-05-14T12:00:18.664Z","url":"https://daily.dev/posts/ypMPuWB45#c-aSw2T5Nqf","author":{"@type":"Person","name":"Tonči Žižić","url":"https://daily.dev/tonciz","image":"https://lh3.googleusercontent.com/a/ACg8ocKB5iyHU5QrnWATv8pnVjskJ92QftjkJ9yoO0tn6-ThlkA-VGNPuw=s96-c"}}]}
```

