Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to checkout a file into previous revision in egit

Tags:

git

eclipse

egit

could please anybody tell us if it is possible and if it is not, what is the best alternative to do it ? This is how it would be done in command line : git checkout HEAD~1 -- path/to/file

But if the project is big, navigating to that file in cmd can be annoying ....

like image 649
lisak Avatar asked Dec 30 '10 00:12

lisak


People also ask

How do I revert a commit in EGit?

Go to the Git history. Right click on the commit you want to revert. Select revert commit.

How do I see changed files in eclipse?

In the Eclipse Navigator view (or any Eclipse view that supports Team operations), right-click the file or folder and click Team > Show History.


2 Answers

You can do this with EGit version 1.0 or higher (it might also be possible with earlier versions, but 1.0 is the first version I noticed the feature).

  1. Right-click on the file you wish replace with an earlier commit, and select Replace With -> Commit...
  2. You will be presented with a list of commits to choose from. Select the commit you wish to replace the file with.
like image 149
Jim Hurne Avatar answered Oct 08 '22 15:10

Jim Hurne


This is available in EGit 2.0:

Select the file(s)/folder(s) you want to replace with another version and use any of the commands:

  • "Replace with > Commit..."
  • "Replace with > HEAD revision"
  • "Replace with > Branch, Tag, or Reference"
  • "Replace with > File in Git Index"
like image 26
Matthias Sohn Avatar answered Oct 08 '22 15:10

Matthias Sohn