---
title: "Discussion on \"How I Fixed a Git Mistake and Restored My Main Branch\" | Hashnode"
description: "Discussion on \"How I Fixed a Git Mistake and Restored My Main Branch\". Learn how I recovered my main branch after accidentally pushing to the wrong Git repository. Step-by-step guide on using git reset and git push --force to"
url: "https://hashnode.com/posts/how-i-fixed-a-git-mistake-and-restored-my-main-branch/680ebb4381e56dde613b3d22"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How I Fixed a Git Mistake and Restored My Main Branch](https://codeknight.hashnode.dev/how-i-fixed-a-git-mistake-and-restored-my-main-branch?utm_source=hashnode&utm_medium=feed)

Learn how I recovered my main branch after accidentally pushing to the wrong Git repository. Step-by-step guide on using git reset and git push --force to

Apr 27, 2025 · 3 min read · codeknight.hashnode.dev  
Read the article

-   [#git](https://hashnode.com/tag/git)
-   [#github](https://hashnode.com/tag/github)
-   [#opensource](https://hashnode.com/tag/opensource)
-   [#coding](https://hashnode.com/tag/coding)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Uthman Abdurrahman](https://hashnode.com/@Codeknight)

@Codeknight · Katsina, Nigeria

  
[View profile](https://hashnode.com/@Codeknight)

I'm a junior front-end web developer

I'm passionate, frontend Web Dev, aspiring fullstack...

## Responses 1

Markdown supported · ⌘↵ to post

[Muhammad Khalil](https://hashnode.com/@DevKhal)

[Apr 28, 2025](https://hashnode.com/posts/how-i-fixed-a-git-mistake-and-restored-my-main-branch/680ebb4381e56dde613b3d22/comment/680f0c526e5a426a423ce540)

Thank you for sharing
