0

enter image description here

enter image description here

When working with a project in the intellij idea, after making any changes (changing the text of the code or creating a file), these changes are immediately transferred to other branches.

If you delete them (these changes or files) on any of the branches, they will also be deleted from anywhere. Previously, this was not and the changes were stored only on one branch, what could be the problem?

Slava Vedenin
  • 58,326
  • 13
  • 40
  • 59

2 Answers2

0

If you create a new file and don't push it in any commit before change branch, this file is stored in any branch.

I see Task5 is green, that is mean the class isn't push to branch or any commit, when you change branch to master this class is saved, also before commit deleted this class is deleted in any branch (because, in real this class isn't saved in any branch at all, it is just a file in your file system).

Slava Vedenin
  • 58,326
  • 13
  • 40
  • 59
0

I'm not sure what you're showing the screenshots, but it is important to understand how Git works because it is very different than other version control systems.

When adding files to a project, until you've committed the files, they are not in any branch - they are "unstaged" or possibly "staged" and not committed. If you then switch to another branch, Git won't remove this file because there is no version of it committed, so removing it will just delete data that cannot be restored.

So Git will not hide/delete/remove uncommitted files (and even line changes) and instead will keep them in the working copy even if you switch branches.

You can see the file is uncommitted in the file tree because it is colored green. See the InteliJ IDEA color coding for version control here: https://www.jetbrains.com/help/idea/file-status-highlights.html

Guss
  • 30,470
  • 17
  • 104
  • 128