![]() To undelete without a hard reset I need to depend on on Local History, or resort to command-line git. I cannot replace the file from the Index. I can un-stage it - that's as far as I can get using egit. ![]() The deletion is listed as a Staged Change in the Git Staging view, but I can't undelete from there. Thus the Explorer view gives me no indication whatever that I have an un-commited modification. Worse, the parent directory does not have the expected '>' decoration. I tried deleting a single file to see if Git Tree Compare would show the deletion. But if you don't have command-line git and you act promptly, you can probably restore your deleted files this way.īad news: all the previously mentioned issues regarding deleted directories also apply to individual files, even when the containing directory still exists. Using command-line git is probably easier, especially with Terminal view, and certainly more reliable. Obviously this depends on your Local History preferences and the specific context in which you try to restore after a delete. Good news: you can generally restore deleted files, and the containing directories, via Restore From Local History. Afterwards, to remove all unstaged changes (those changes that differ only in whitespace), you can do: git checkout. Something like svn's REVISIONS or cvs's Dates nodes) in the git repositoryĬontinuing with these experiments, there's good new and bad news. To stage changes that are not just whitespace changes, you can do: git diff -U0 -w -no-color git apply -cached -ignore-whitespace -unidiff-zero. Hunt for the specific commit that last changed/deleted that fileī) Support browsing the tree for a branch/tag or even specific commits (with ![]() History view - while this wouldn't hurt, it's still not so nice to have to Select those files/folders and right click on them to open the Git context menu, where you can click Undo Changes. By default, folders themselves will no be deleted. If you want to only delete untracked files in a certain subdirectory of your project, you can additionally specify a path: git clean -f folder/subfolder. Now you've seen the various methods Git provides for undoing changes. Use Git reset -hard to point the repo to a previous commit.Git reset -hard is for when you want to discard all uncommitted changes. Try Git checkout - to discard uncommitted changes to a file.That would be useful for other situations as well and corresponds closely to the standard command-line Git fix.Ī) Having 'checkout' (and maybe reset soft/mixed) on file entries in the To actually allow git clean to delete files in your working copy, youll have to use the 'force' option: git clean -f. Git stash lets you discard changes and save them for later reuse. The most general solution would seem to be an optional path in the egit 'checkout' dialog. > If there is no other way, egit probably needs one. > Is there some way to do this, other than a reset, that I'm not seeing? Obviously a reset is no good if there are other other un-commited changes. Note that this situation also applies if you delete the directory from within Eclipse, it's not specific to doing the delete externally. Confirming after some experiments that there doesn't seem to be any way in egit to restore a deleted directory, short of a hard reset of the repository.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |