Git Branching Question


If I have a file on my local main branch that I want to test something on, and I:

Create a new local branch
Switch to that branch
Open the file and make changes
Close the file
Switch back to the main branch
Open the file on the main branch

My changes also show up on the main branch (not what I was expecting).

How do I keep my changes on a new branch separate from the main branch (until I decide to merge them)?


Did you commit the changes to the “feature” branch before switching back to the main branch?

1 Like

No, I think that was the problem. I just read an article saying “Switching branches carries uncommitted changes with you.” So I guess I just need to commit or stash before switching.

Thanks for responding!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.