How can i completely undo git commit just done

I did commit on my branch.

I accidently added .tar.gz files in it which i want to ignore.

Then i did this

git reset --soft HEAD^

Now my commit is gone

  1. Modified files are as it is
  2. But the untracked files are now being shown as new file

How can i go back to state where the new files come as untrcaked file


A git reset --soft only moves HEAD, but don't reset the index.

A git reset @^ would moves HEAD and reset the index, making those files untracked again.

More on those reset options at "Can you explain what “git reset” does in plain english?".

See also a good illustration in "Difference between git reset soft, mixed and hard": what you want is to reset HEAD and index, not the working tree.

The OP user3646965 asks in the comments:

I have already executed git reset --soft, can I do git reset @^ or it will go back one more commit?

Then you can do a reset for the files only (not HEAD, which already references the right commit)

cd /path/to/folder/containing/tar.gz_files
git reset -- *.tar.gz

Note the double-dash (--) between the git command and the files.

Need Your Help

How to make a multiline cursor without using a mouse in Sublime text 3?


The only way to make a multiline cursor in Sublime text 3 is Ctrl+Shift+RC+Drag. Is there any way to do this without using a mouse?

Do I need to specify kernel modules in a particular order while using modprobe to insert them?

linux-kernel kernel-module

I have a list of modules in a shell script variable, lets call it modulelist. Some of those modules are already loaded.