6

Is there a way to override/replace the local changes from the version controls (like svn, CVS)? In Eclipse, I can right click on the project->team->synchornize.. then it shows all changes comparing to the repository. Then, If I need to override the file, "update and override" option is there. Correspondingly, Is there such a way to replace local changes in a class or a package with one click in IntelliJ Idea?
(I found a way to compare incoming changes, then I had to get one by one changes to my local class files) . I use IntelliJ Idea community edition 15

5 Answers 5

9

For single file you can follow below steps :

a) Right click on file

b) Git ---> Show History

c) It will show a window in which you can see the history of changes, select a commit,right click on it. Select Get.

Link : https://intellij-support.jetbrains.com/hc/en-us/community/posts/207743285/comments/207412185

Sign up to request clarification or add additional context in comments.

Comments

0

If I understand the question right, I think you need to revert your local changes then update from the remote. You can do this at a class or package level, or on the whole project.

1 Comment

Thanks for the answer. Anyway, then it is a two steps.. isn't it?
0

I think it is going to be an two way process.

  1. Revert the changes (Ctrl+Alt+Z).
  2. Update the project (Ctrl+T).

Comments

0

Choose the project(if you have multiple files changed), right click -> GIT -> Compare with branch(select the branch which you want to override your changes) -> it will show the differences it detected -> click "Get" icon, it prompts "Some files were locally modified" -> choose "Overwrite Modified Files"

But sometimes it doesn't work well.

Another simple but dangerous way is to use git command:

git fetch --all

git reset --hard origin/master

(Then all your local change will be lost)

Comments

0
  1. Commit -> right click on "Default changes" -> "Shelve changes..." -> Check if all files selected -> click "Shelve changes"
  2. "VCS" -> "GIT" -> "Pull..." -> Check params -> "Pull"

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.