I cloned a git repo and then started playing around in its master branch. After a while, I want to ignore the changes I just made (without committing them), and switch to a diff
OP asks to ignore changes - but does not ask to remove them. Sounds like OP want changes to still be around. So this answer is for those folks in a similar situation who don't want to lose their changes.
Given the limitations encountered already, plus given you want to keep those changes, one option is to put them in another branch
Regardless of where you have either uncommitted or staged changes, you can always make a new branch with
git checkout -b new_branch
and then git add
and git commit
as necessary. and now you can switch to other branches at will, knowing these changes have been saved.
Like the OP I don't like to use stash and pop (and cherry pick) but isolating these changes by putting them into a new branch I can then merge and rebase to and from works well for me. Using branches for the solution is easy for me