I'm looking for a way to undo changes in selected directory, analogue of git checkout [folder-path] in Magit.

I found that I can reset changes of specific file to selected branch by typing X f in magit-status, but I didn't find a way to do the same for folders.

Is there a way to achieve that in Magit?

  • 2
    You can select all the relevant changes in the status buffer, and type k to kill them.
    – phils
    Commented Jan 20, 2021 at 23:47
  • @phils yes but it's still per file rather than entire folder.
    – Navidot
    Commented Jan 21, 2021 at 8:18
  • 2
    Sure. But as with git itself, magit only shows you files rather than directories (the latter being implicit in the former). If you particularly don't want to deal with files, I would just use : to run the git command line you initially mentioned.
    – phils
    Commented Jan 21, 2021 at 12:23
  • 1
    Thanks, I think : is what I was looking for.
    – Navidot
    Commented Jan 21, 2021 at 20:34


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.