Débora
Débora

Reputation: 5952

Intellij Idea: Override and update local changes

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

Upvotes: 5

Views: 13705

Answers (5)

Aricann
Aricann

Reputation: 3

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

Upvotes: 0

Phoenix
Phoenix

Reputation: 105

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)

Upvotes: 0

avinash
avinash

Reputation: 1774

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

Upvotes: 8

user2369585
user2369585

Reputation: 11

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

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

Upvotes: 0

Software Engineer
Software Engineer

Reputation: 16140

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.

Upvotes: 0

Related Questions