- I am currently on the "master" branch.
- I created a new branch (from the master branch) to work on a new "users" feature. that's why i called this new branch "users".
- I had to stop my work and go back to the master branch.
- I stashed "users" for all the files i was working on - so basically my status is empty.
- Now I can safely checkout back to the "master" branch.
- "master" branch shows me one of my folders (
node_modules
) as if I added it and "ready to add and commit" - as if it was dragged from the previous repository.
PROBLEM:
I keep getting the changes from the previews branch ("users") in my master branch.
If I delete these files - I would have no problem to work on my master branch - but when returning to the "users" branch - these files are gone (because i deleted them in the master branch)
It seems like I somehow have a "static" folder that is dragged to every branch
What might be the problem with my git ?
The folder I am referring to is the node_modules
folder. I'm not sure I remember what happened to it, I added it in the beggining, then deleted it. made sure it's not displayed in the repo in "bitbucket". then had git update-index --assume-unchanged $(git ls-files | tr '\n' ' ')
run on the whole folder. It just keep poping up in every branch i move to.
WHAT I EXPECT TO HAPPEN:
- I am currently on the "master" branch.
- I created a new branch (from the master branch).
- I had to stop my work and go back to the master branch.
- I stashed "users".
- Now I can safely checkout back to the "master" branch.
- "master" branch is empty to work on - some files "disappeared" since they don't exist on this branch).
If git stash is misbehaving for any reason, another approach is:
When you need to stop, add everything and commit in your current branch, then switch back to master.
When you resume your work on user, you can cancel the last commit:
Your changes and work in progress will be there, ready to be (once again) added and committed.