user818455 user818455 - 1 year ago 83
Git Question

How to refresh project file when I switch to another branch using Android Studio terminal?

I am using GIT in my Android project for version control, also I am using terminal provided in IDE to execute all the GIT related commands like add, commit , push etc. I created a new branch using

git checkout -b dev
and then modified few lines of code , after that I switched to the original master branch using
git checkout master
and I saw my original files also have been modified even though I have not merge yet.

I don't know why is this happening as it was working file earlier, could someone please guide me how to solve this issue?

Answer Source

You should commit changes in new branch and then move to previous branch. After checkout -b dev you are in new branch. Edit your files and commit changes. These changes will be committed to new branch and then go to you master branch to see same file with old snapshot.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download