Home > front end >  Android Studio Git works weird I think?
Android Studio Git works weird I think?

Time:01-09

Hello I am using Android Studio 2020.3.1 Patch 4. I'm using Git and committing a state. And then add some code and I want to return to where I was (before I entered the new code). When I checkout it does nothing. Even if I restarted Android Studio. And when I Reset Current Branch to Here.. initially it does nothing but if I restart the Android Studio new code is gone(as I wanted). What am I doing wrong?

CodePudding user response:

The correct command to remove the newly added but not commited code is:

git stash

It will remove the unstaged codes and return the code-base to the last commit.

We normally use 'git checkout' to move around between different commits.

If you want to do this process without command, you will need to "Rollback changes". The keyboard shortcut for macos for this is: option command z. Shortcut for Rollback changes

Rollback changes in the whole project

  •  Tags:  
  • Related