Skip to content

Branch switching UX is confusing sometimes when 'bring my changes' and .gitignored files #17883

Open

Description

@0xdevalias

The problem

It's also pretty confusing when on one branch I have some files .gitignored, switch to a branch that doesn't have them ignored, then switch back, and get shown this dialog:

image

I would assume the correct choice out of those should be 'Bring my changes'; but then when I get back to my branch with the .gitignore, all of these files are suddenly visible in the GitHub Desktop UI, and a bunch of unexpected conflicts/etc.

I believe this is because when switching the branch like this, GitHub Desktop stages everything; which is kind of unexpected, and definitely not desirable.

If I then do a git reset on command line, the view in GitHub Desktop looks far more normal/expected; with seemingly the only remaining issues being the files that had previously conflicted (as I now have to remove the conflict syntax), and any actual remaining differences.

Originally posted by @0xdevalias in #12699 (comment)

Release version

3.3.6

Operating system

macOS Ventura (13.5)

Steps to reproduce the behavior

No response

Log files

No response

Screenshots

No response

Additional context

No response

Activity

  1. niik commented on Dec 20, 2023

    @niik
    Member

    Hey @0xdevalias, thanks for reaching out.

    I would assume the correct choice out of those should be 'Bring my changes'; but then when I get back to my branch with the .gitignore, all of these files are suddenly visible in the GitHub Desktop UI, and a bunch of unexpected conflicts/etc.

    I'm unable to reproduce this. When you "bring your changes" what we do is we stash all uncommitted changes, switch branch, and pop that stash. Assuming you haven't made changes to these ignored files I don't see how they could create conflicts. Can you provide more detailed reproduction steps?

  2. added
    more-info-needed
    on Dec 20, 2023
  3. github-actions commented on Dec 27, 2023

    @github-actions
    Contributor

    Thank you for your issue!
    We haven’t gotten a response to our questions above. With only the information that is currently in the issue, we don’t have enough information to take action. We’re going to close this but don’t hesitate to reach out if you have or find the answers we need. If you answer our questions above, this issue will automatically reopen.

  4. 0xdevalias commented on Jan 5, 2024

    @0xdevalias
    Author

    I still need to get back to testing this fully, but I just noticed something today that might explain it.

    On the CLI, if I do git stash push -u, and those changes include .gitignore, then the previously ignored files are now visible, and I would have to do another git stash push -u to actually stash them.

    My guess is that a similar thing is happening here with the branch switching.

  5. removed
    more-info-needed
    on Jan 5, 2024
  6. added
    investigation-needed
    on Oct 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    investigation-needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions