gitrebasefixup

Git - Is it safe to rebase while main IDE is open?


I'm someone which often rebases feature-related commits for fixing them up. Lately I've been concerned in whether having the main coding IDE open can affect something going wrong in the rebase process.

For instance, when there's a "pause" within the rebase process because user is to perform some action (e.g. renaming a cetain commit), would clicking on the usual "file changed externally, refresh it?" prompts that some IDEs offer -before completing the rebase- affect the final working directory state upon rebasing in contrast to keeping the editor closed?

This concern usually makes me wonder whether I should close the editor or not before rebasing commits involving certain loads of changes, and I usually go depending on my feeling at the moment. Of course, I'm also concerned because I have feared in the past that some changes had been potentially lost due to this kind of scenario (althought, in that case, I could also have messed something Git wise).

EDIT: I realize now that when being prompted with the dialogs similar to "File changed externally, refresh it?" caused by rebasing (for the case) it shouldn't cause any problem since file already changed as rebasing pleased. Therefore, what I want to know now is:

Q2) What if when being prompted with "File changed externally, refresh it?" you click No, so that file reverts its contents to the old, and then you save that file and continue the rebasing process? (e.g. closing the active interactive summary tab in case of renaming a commit, or performing a git rebase --continue after resolving some conflict, not necessarily in the externally changed file). Would it cause the file to end with different contents after completing the rebase in contrast to not having re-saved the old overridden contents manually?


Solution

  • Is it safe to rebase while main IDE is open?

    Yes¹

    Because the IDE being open, unless it's saving files none-interactively or something, isn't going to affect/change files on disk.

    What IDE operations are fine?

    Anything which does not affect the working copy, examples:

    What IDE operations are a problem?

    Anything which unintentionally (in terms of the in-progress git rebase) updates files, or a git write operation, examples:

    If you want to, for example, use your IDE to resolve a conflict - that's perfectly fine, if the intent is to update a file during a rebase - there's no problem using your IDE to do so :).


    ¹ - As Torek commented, there are or were IDEs/editors which may be problematic, but that would be exceptionally rare and not the rule today.