---
title: "Discussion on \"Remove Files From Staging Before Committing\" | Hashnode"
description: "Discussion on \"Remove Files From Staging Before Committing\". Say you have added main.js to the staging area but later you realised that you don't want to commit it.\nYou have two ways to achieve it.\nThe old way\ngit reset HEAD main.js\n\nThe new way\ngit restore --staged main.js"
url: "https://hashnode.com/posts/remove-files-from-staging-before-committing/648938929917401090e653b9"
---

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

Discussion

# [Remove Files From Staging Before Committing](https://sksundram.site/remove-files-from-staging-before-committing?utm_source=hashnode&utm_medium=feed)

Say you have added main.js to the staging area but later you realised that you don't want to commit it. You have two ways to achieve it. The old way git reset HEAD main.js The new way git restore --staged main.js

Jun 14, 2023 · 1 min read · sksundram.site  
Updated Mar 7, 2024  
Read the article

-   [#git](https://hashnode.com/tag/git)
-   [#tips](https://hashnode.com/tag/tips)

## Written by

[Shailesh Kumar Sundram](https://hashnode.com/@sksundram)

@sksundram · Bengaluru, India

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

Full-stack developer

Terminal &amp; Vim aficionado

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
