How do I "git checkout -f" from emacs-git?
In emacs-git mode for emacs, is there a way to do checkout -f
or an equivalent?
I just recently started using emacs-git. I liked this so far until I tried to switch to a different branch and received a message that "the raw working tree file will be overwritten" and the checkout was canceled.
Previously, when using git from the command line, I always did git checkout -f <branch>
to switch branches, but I can't seem to find the equivalent of a switch -f
in emacs-git.
Any ideas?
source to share
A command git checkout -f
is a much more dangerous command than not using a flag -f
, is this really what you want to do? You run the risk of accidentally dropping changes that have not yet been verified anywhere.
The error you received is related to a file that is not tracked on your current branch (but the file exists on disk), but is tracked on the branch you are changing to. Git wants to overwrite the unused file with the one that was checked out from the new branch. What if there was something important in this file? The error message indicates that you must first do something with this file before switching branches.
source to share