---
url: 'https://simonerescio.it/en/2016/07/git-how-to-unfuck-by-melanie-g-patrick'
title: 'Git &#8211; How to unfuck by Melanie G. A. PATRICK'
author:
  name: Simone Rescio
  url: 'https://simonerescio.it/en/about-me/'
date: '2016-07-26T01:38:10+02:00'
modified: '2026-04-24T21:41:36+02:00'
type: post
summary: 'A git cheat sheet by Melanie G. A. PATRICK (Trivago) for when commits go wrong — plus a personal tip: use git fetch --tags to explicitly update tags, especially before git 2.0.'
categories:
  - WebTech
tags:
  - git
image: 'https://simonerescio.it/wp-content/uploads/2016/07/git.jpg'
published: true
---

# Git &#8211; How to unfuck by Melanie G. A. PATRICK

A nice handbook for “unfucking” git commits with command line when things get ugly by *Melanie G. A. PATRICK* from [Trivago](https://www.trivago.com/)

One I’d like to add myself, found out firsthand today, is about *fetching.*

Let’s say you created some new tags on BitBucket/Stash/YourGitRepositoryOfChoice and now you want to checkout locally one of these new tags. You might assume that firing a “*git fetch*” will update everything, you proceed to checkout the tag but your command fails.

Turns out that if you want the tags to be updated, you’ll have to ask for them *explicitly* :

```
git fetch --tags
```

Before version 2 of git, the `fetch` command alone would update branches heads and with `--tags` option would update only tags, [after version 2](https://github.com/git/git/blob/d7aced95cd681b761468635f8d2a8b82d7ed26fd/Documentation/RelNotes/1.9.txt#L18-L20) when the option is included it will update tags *and* branches heads, aligning local workspace with remote repository.

 [](https://mastodon.social/share?text=http%3A%2F%2Fsresc.io%2FtET&title=Git%20-%20How%20to%20unfuck%20by%20Melanie%20G.%20A.%20PATRICK)[](https://www.linkedin.com/sharing/share-offsite/?url=http%3A%2F%2Fsresc.io%2FtET)[](https://simonerescio.it/en/2016/07/git-how-to-unfuck-by-melanie-g-patrick)[](https://reddit.com/submit?url=http%3A%2F%2Fsresc.io%2FtET&title=Git%20-%20How%20to%20unfuck%20by%20Melanie%20G.%20A.%20PATRICK)[](https://api.whatsapp.com/send?text=Git%20-%20How%20to%20unfuck%20by%20Melanie%20G.%20A.%20PATRICK http%3A%2F%2Fsresc.io%2FtET)[](https://bsky.app/intent/compose?text=Git%20-%20How%20to%20unfuck%20by%20Melanie%20G.%20A.%20PATRICK%20http%3A%2F%2Fsresc.io%2FtET)[](https://telegram.me/share/url?url=http%3A%2F%2Fsresc.io%2FtET&text=Git%20-%20How%20to%20unfuck%20by%20Melanie%20G.%20A.%20PATRICK)[](https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2Fsresc.io%2FtET)

