'Duplicate effort when switching branches? reinstall dependencies?

For example, I worked on a branch called abc, and installed dependencies and added code in package.json, setupTests.js, .gitignore etc.

and the branch abc is now under PR.(so everything from abc is not in master)

now i am working on a newly created branch, and you can guess all dependencies i installed and configured etc that done on branch abc is not here, so request me to re-do all these.

I wonder what is the best solution or if you also undergone such thing? thanks.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source