<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/how-to-checkout-the-previous-branch-in-git-9olqm5vuj" -->

---
title: How To Checkout The Previous Branch In Git | daily.dev
description: A quick tip showing how to switch back to the previously checked-out Git branch using `git checkout -` (shorthand for `git checkout @{-1}`). The post explains...
canonical: https://daily.dev/posts/how-to-checkout-the-previous-branch-in-git-9olqm5vuj
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: How To Checkout The Previous Branch In Git | daily.dev
og:description: A quick tip showing how to switch back to the previously checked-out Git branch using `git checkout -` (shorthand for `git checkout @{-1}`). The post explains...
og:url: https://daily.dev/posts/how-to-checkout-the-previous-branch-in-git-9olqm5vuj
og:image: https://api.daily.dev/og/posts/9Olqm5vuj.png
og:image:alt: How To Checkout The Previous Branch In Git
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.

# How To Checkout The Previous Branch In Git

**[Marc G Gauthier](https://daily.dev/sources/marcgg)** · 2 min read · 0 upvotes · 0 comments

## Summary

A quick tip showing how to switch back to the previously checked-out Git branch using `git checkout -` (shorthand for `git checkout @{-1}`). The post explains the underlying syntax from Git documentation, provides a concrete example with multiple branches, and suggests a shell alias `alias g-='git checkout -'` for even faster navigation. Available since Git 1.6.2.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://marcgg.com/blog/2015/10/18/git-checkout-minus/>

## Similar posts on daily.dev

- [Git UNDO : How to Rewrite Git History with Confidence](https://daily.dev/posts/git-undo-how-to-rewrite-git-history-with-confidence-p2tuql4z7) · Towards Data Science · 1 upvotes · 0 comments
- [The Git Recovery Guide: How to Undo Anything \(Without Panic\)](https://daily.dev/posts/the-git-recovery-guide-how-to-undo-anything-without-panic--alupd6iws) · DEV · 1 upvotes · 0 comments
- [Git Commands For a Single Commit](https://daily.dev/posts/git-commands-for-a-single-commit-rbwx1zjhh) · Atomic Spin · 1 upvotes · 1 comments
- [Archiving git branches as tags](https://daily.dev/posts/archiving-git-branches-as-tags-fo7e00jw3) · Hacker News · 2 upvotes · 0 comments

---

Tags: [#git](https://daily.dev/tags/git), [#cli](https://daily.dev/tags/cli), [#version-control](https://daily.dev/tags/version-control)

[View this post on daily.dev](https://daily.dev/posts/how-to-checkout-the-previous-branch-in-git-9olqm5vuj)

```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":"How To Checkout The Previous Branch In Git","url":"https://daily.dev/posts/how-to-checkout-the-previous-branch-in-git-9olqm5vuj","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/how-to-checkout-the-previous-branch-in-git-9olqm5vuj"},"datePublished":"2026-03-26T08:35:56.592Z","dateModified":"2026-03-26T08:37:06.137Z","description":"A quick tip showing how to switch back to the previously checked-out Git branch using `git checkout -` (shorthand for `git checkout @{-1}`). The post explains...","image":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2424809fbb6e3b624c293ad055ac4068?_a=AQAEuop","thumbnailUrl":"https://media.daily.dev/image/upload/f_auto,q_auto/v1/posts/2424809fbb6e3b624c293ad055ac4068?_a=AQAEuop","isAccessibleForFree":true,"articleSection":"Marc G Gauthier","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":"Marc G Gauthier","logo":"https://media.daily.dev/image/upload/s--P4lsZKFE--/f_auto,q_auto/v1774514113/logos/marcgg?_a=BAMAMiWQ0","url":"https://daily.dev/sources/marcgg"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/how-to-checkout-the-previous-branch-in-git-9olqm5vuj","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"git,cli,version-control","timeRequired":"PT2M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"Marc G Gauthier","item":"https://daily.dev/sources/marcgg"},{"@type":"ListItem","position":3,"name":"How To Checkout The Previous Branch In Git"}]}
```

