Skip to content

[Git] Cancel the Items to Be Submitted by "git add"

Last Updated on 2021-10-31 by Clay

If you used git add to trace the items you want to submit, but suddenly you found you add the wrong items... in the first time, you can use git status to check the add item list, and use git reset to cancel the item.


Example

Assume that I have submitted and tracked all the items.

git add *
git status


Output:

It can be found that I accidentally added the entire virtual environment venv folder. So if I want to push it on GitHub, it will be very large. If I want to clone and continue working on other devices in the future, I do not want to pull down the entire environment.


In this time, we can use git reset to cancel the items added.

git reset venv
git status


Output:

Then you can submit with confidence.


References


Read More

Tags:

Leave a ReplyCancel reply

Exit mobile version