idea非活动变更列表中的文件被修改_IntellJ IDEA中的更改列表是什么?一个变化列表比较什么?寻求准确的解释...

IntelliJ IDEA中的变更列表是用于跟踪代码修改的集合,不同于版本控制系统中的提交。它可以让你在编辑期间组织和管理多个变更集,每个变更集可以关联到特定任务。变更列表在提交时清空,可帮助避免未完成任务的文件被意外提交。当你从旧版本回退时,IDEA会创建新变更列表以区分不同版本间的改动。
摘要由CSDN通过智能技术生成

What is a changelist in IntellJ IDEA ?

A list of changes compared to what?

What does it mean that I can have multiple changelists ?

Especially, when I revert back to an earlier version (using VCS) IntelliJ wants to create a new changelist for that. Why? In that case the changes will be related to what? Let's say I revert to version 9 from version 23. Then the changeslist will contain the changes between version 23 and 9 or between 8 and 9 ?

I tried to read the documentation but it did not give me any enlightment at all.

Is the IntelliJ changelist the same as, for example, the concept of changeset in Mercurial, in which case the changelist is just an other name for a node in the revision history graph, conceptually?

解决方案

A changelist is a set of files you have changed as compared to the version control history. It differs from a version control changeset in that a version control changeset is created when you commit the code. An IDEA changelist is present while you are editing the code, and then is cleared when you commit the code.

IDEA changelists allow you to track the changes you are making. You can quickly view all the files that have changes (as compared to the last version control update/pull). They are very helpful in that you have have multiple changesets created at a time (but only one active), and they can be linked to tasks (i.e. tickets or bug trackers).

So lets say I'm working on "new search feature". I create a changelist for that and make it active. As I code, all my changes go on to that list. As I am working, I get an emergency bug fix for a DB Hang. I create a "DB Hang" changelist and make it active. Now any changes/edits I make go on the "DB Hangs" changelist. When I am completed, I can commit only files on the "DB Hangs" changelist. This prevents any of the files I changed while working on the (still incomplete) "new search feature" task. Once the "DB Hangs" code fix is committed, I make the "new search feature" changelist active and (most likely) delete the "DB Hangs" changelist and continue on with the coding of the new search feature. I personally also have a "Do Not Commit" changelist where I put any changed files I do not want to commit to version control (for example changes to a config file for isolated/local testing). Note: you can easily move changed files from one changelist to another.

When you have multiple changelists -- such as the above bug example -- if you try to modify a file on the active changelist that is also on an inactive changelist, IDEA warns you and the file name turns red. For example, lets say that as part of my initial work for the "new search feature" I made a change to "User.java" that is dependent on a number of new files I created for the "new search feature" work. I then get the emergency bug and make and switch to the "DB Hangs" changelist. As I am fixing that bug, I realize I need to make a change to User.java. When I start editing the file IDEA warns me it is part of another changeset. This prevents me from later on committing User.java without the new code it depends on and thus breaking the build. When I get that warning I have to make a decision on how to handle it. I could shelf the "new search feature" changelist before editing User.java for the "DB hangs" fix, and then unshelve it afterwards. (This is typically the best thing to do when a lot of files are needed in both fixes.) Alternatively, I could move the file to the "Db Hangs" changelist. Then if I determine the changes are OK to go in with the bug fix (i.e. has no other dependencies) I can just commit together. Or I can rollback the changes in that file. (And then use local history later to get them back). Or I could comment out the changes. Etc.

UPDATE

Sorry, I forgot to answer this question:

Especially, when I revert back to an earlier version (using VCS) IntelliJ wants to create a new changelist for that. Why? In that case the changes will be related to what? Let's say I revert to version 9 from version 23. Then the changeslist will contain the changes between version 23 and 9 or between 8 and 9

When switching to a different VCS version, IDEA will only want to create a new changelist if you have made code changes to the version that was previously active. The reason for that is the code changes you made are "changes to version 23 of this file". When you revert to version 9, those changes are no longer valid per se. It assumes you want to track the changes you make to version 9 separately. I've never run into this situation (based on my personal workflow for working with older versions or branches). But if you wanted to use the changes you made while viewing version 23 with version 9, you should be able to move then over to the new changelist, or make the original change list active.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值