Discarding changes in working directory not working

Hi,

I have the following git status:

>git status
On branch BR1
Your branch is up-to-date with ‘origin/BR1’.
Changes not staged for commit:
(use “git add <file>…” to update what will be committed)
(use “git checkout – <file>…” to discard changes in working directory)

modified: app/Branch.php

Following the above advice provided by git I tried to discard changes in app/Branch.php, so I did:

>git checkout – app/Branch.php

Nothing appeared on the screen, so I assumed, everyting went ok. However, it does not affect the repo:

>git status
On branch BR1
Your branch is up-to-date with ‘origin/BR1’.
Changes not staged for commit:
(use “git add <file>…” to update what will be committed)
(use “git checkout – <file>…” to discard changes in working directory)

modified: app/Branch.php

What do I do wrong?

1 Like

You can find the solution here , try to run this:

$git checkout app/Branch.php
1 Like

Thanks, sure I tried it, but with no effect:

c:\xampp\htdocs\ek>git checkout app/Branch.php

c:\xampp\htdocs\ek>git status
On branch master
Your branch is behind ‘origin/master’ by 66 commits, and can be fast-forwarded.
(use “git pull” to update your local branch)
Changes not staged for commit:
(use “git add <file>…” to update what will be committed)
(use “git checkout – <file>…” to discard changes in working directory)

modified: app/Branch.php

1 Like

After updating git to newest version it does not report any changes not staged for commit. Strange, since I just updated git, I didn’t checkout the files.

c:\xampp\htdocs\ek>git status
On branch master
Untracked files:
(use “git add <file>…” to include in what will be committed)
.env_kopia

I recommend you to use Gitkraken it’s very user frendly and powerfull.

This has been most of my experience with git.  Checkout does absolutely nothing and I’m beginning to consider conspiracy.

Checkout does nothing

It does nothing

And it’s all over the internet that it does nothing and everyone avoids the question.

I cannot download previous versions, making github just an upload site.

1 Like

No, @carocrazy132, I don’t think it is a conspiracy :slight_smile:

If you’re having trouble with the command line, I do indeed suggest using a visual tool like GitKraken or built-in ones at Visual Studio or Atom like @wabri mentioned.

Anyway, if you want to use the command line, all info you need should be in here: https://stackoverflow.com/a/14075772

1 Like

I have the same issue using GitKraken.

Hi @andresams,

Could you please psot some sort of log of the errors?

Thanks

-Gabriele-

Mark helpfull posts with Accept as Solution to help other users locate important info. Don’t forget to give Kudos for great contents!

GitKraken does not see this situation as an error, so there is no log. The file just keeps appearing again and again.

I am a GitKraken pro user so I will ask them directly for support.