EGit - "Replace with commit ..." doesn't work as excluded

I am using EGit with Eclipse Indigo SR 2 Build 20120216-1857 .

Almost everything works well except for the function Replace With -> Commit...

. It actually works, but does not restore the project exactly the same way because it left behind new files that I have added since then.

It looks like it is doing some sort of combination between the current HEAD and the commit I choose to restore. I really want to replace the content of my project with the previous commit, as it does when switching between branches.

Is there any solution? And does anyone know if the latest version of Eclipse supports a fully functional version of EGit?

Or am I misunderstanding this function?

+3


source to share


3 answers


@VonC pointed me to one solution, but that's not exactly what I want.

I tried the Reset command, but first I had to mark the commit to be able to select it. Then it changes the entire branch master

and undo the next commits. I don't really want to change any branch or remove any commits, I just want to go back to the previous one to see all the code and eventually run it.



Finally, I can get it to work using Checkout in commit. To see all commits:Right click on your project -> Show In -> History

It won't change any branch you were working on, but just replace the contents of your project with the one the commit saved.

+3


source


The " Replace with

" that I know in Egit is about git checkout (and not like robinst's comments below ). And the check is not the same as reset . git revert


I really want to replace the content of my project with the previous commit, as it does when switching between branches.

This will be closer to the "Reset" function . Choosing "hard reset" will delete any private file and completely restore the index and working tree to the selected commit.

reset in Egit



(from " How do I remove commits with Egit? ")

hard

- HEAD now points to a new commit, index and working tree are updated.

You can also see it in this tutorial :

reset in Egit bis

+3


source


Newly generated files are not in git index (untracked) unless you add them. Since you revert the workspace back to the commit, only your tracked files (added to the git index) will change. Newly created files are not affected.

If you want to delete your unprocessed files:

git clean -f -d

will do it.

0


source







All Articles