Discussion:
Expected bug with reset --hard
Nicholas Chmielewski
2014-10-15 04:34:12 UTC
Permalink
git version 1.9.1 & version 2.1.2

I had some changes in a tracked file that I wanted to discard.
Instead of using checkout, I instead used `git reset --hard HEAD` to reset.

Git returned the message `HEAD is now at <sha> <commit-message>`
I then went `git status` and it showed me that I still have changes to commit

I expected there to be no changes in my working directory as a result of
doing a `git reset --hard`

I did a little more fiddling around and still yielded the same results.

- `$ touch file.md`
- `$ git add file.md`
- `$ git commit -m 'empty file'`
- `$ echo 'text' > file.md`

At this point git reported that I had uncommited changes for both file.md and
the troublesome file in question (jquery.datatables.js)

`$ git reset --hard HEAD`

Git now no longer reports and untracked changes for file.md but still
for jquery.datatables.js

`$ git reset --hard HEAD~1`

Git still reports untracked changes for jquery.datatables.js

I have included a copy of the diff of the jquery.datatables.js
Nicholas Chmielewski
2014-10-15 05:47:51 UTC
Permalink
I'd like to rescind my bug report.


A bit more further investigation revealed that git was detecting the
file with changes as jquery.datatables.js but the file in my directory
was reported as being named jquery.dataTables.js .

I'm currently working on OS X 10.9, and this issue is probably related
more to the case-preservation of the file system rather than git
itself.

On 15 October 2014 14:34, Nicholas Chmielewski
Post by Nicholas Chmielewski
git version 1.9.1 & version 2.1.2
I had some changes in a tracked file that I wanted to discard.
Instead of using checkout, I instead used `git reset --hard HEAD` to reset.
Git returned the message `HEAD is now at <sha> <commit-message>`
I then went `git status` and it showed me that I still have changes to commit
I expected there to be no changes in my working directory as a result of
doing a `git reset --hard`
I did a little more fiddling around and still yielded the same results.
- `$ touch file.md`
- `$ git add file.md`
- `$ git commit -m 'empty file'`
- `$ echo 'text' > file.md`
At this point git reported that I had uncommited changes for both file.md and
the troublesome file in question (jquery.datatables.js)
`$ git reset --hard HEAD`
Git now no longer reports and untracked changes for file.md but still
for jquery.datatables.js
`$ git reset --hard HEAD~1`
Git still reports untracked changes for jquery.datatables.js
I have included a copy of the diff of the jquery.datatables.js
Continue reading on narkive:
Loading...