Saving changes from one file inside two different change lists using Git and IntelliJ IDEA

I use Git as VCS and IntelliJ IDEA as IDE.

I want to save local changes (those that I will not make) in the change list with the name "local" and other changes (intended to be committed) in my default change list. The problem occurs when I have local changes and changes that I intend to make in the same file. In this case, before committing, I need to look at all the changes in these files and discard all local changes.

Is there a way to save one part of the changes in the file in the first list of changes and in another part in the second list of changes?

+4
source share
1 answer

No, change lists (and version control for java in general) do not work like that. Also, I think what you are doing is probably wrong, especially considering that you have git.

Assuming you are part of a team, somewhere a centralized shared repo into which you are making your changes (although this works if you yourself click on github) ...

You must have a branch from the wizard for the function you are working on — let her name it “Feature-A”. On your local machine, you must create a local branch to name it "local". So you have this branching structure:

master
  ->   Feature-A
            ->    local

, , - , , . (, , Feature-A), , . , Feature-A ( ). - , , () Feature-A. Feature-A , pull .

, , Feature-A, "", Feature-A, .

+1

Source: https://habr.com/ru/post/1620788/


All Articles