0

Today I have come with a issue that accidently happened with me.

For my current project, I have two local branches in my studio.

Local Branches :

a) master (passive branch)

b) Account (active branch)

and the same on the Remote Server as well.

Yesterday I pushed my local Account branch to Remote.

My Problem :

First I checkout to local master branch and then I clicked on local Account branch and clicked on Rebase onto... :(

And now my both the branch shows the same files and directory structure.

Android Studio is showing messages like

a)Gradles project sync failed.(Basic functionality will not work)

b)Module SDK is not defined.

In every file all the imported modules and library's are showing errors.

I read about Rebase but I am not clear about what it did in my case.

My Questions :

What can I do to revert it back to normal ?

I can't understand, why both the branches are getting the same gradle messages.

Whether it affected to my remote files as well ?

Can I do a Revert from Local History ?

Community
  • 1
  • 1
Ashish Shukla
  • 1,027
  • 16
  • 36

4 Answers4

1

It's fairly simple to do. First off, open the VCS tab in Android Studio.

At the top of the bar, you'll see that it says log:

enter image description here

Right-click on any given revision and select "checkout revision". This does then use the checkout command. Example usage on reverting from the commandline

Alternatively, you can use the revert button:

enter image description here

But you can only revert to the last commit using it, so if you want to go back further it's easier using the first method

And no, you cannot revert using local history. This is file specific history and not VCS history. A single invalidate caches and restart wipes this history, so it isn't reliable to use. Using VCS is better for these cases, especially when you have Git already installed and active in the project

Zoe
  • 27,060
  • 21
  • 118
  • 148
1

If you mess up the rebasing process for example accepting something you do not want to and end up with something like this:

enter image description here

There is a possibility of aborting the whole rebase process from Git>Rebase> Abort Rebase:

enter image description here

MeLean
  • 3,092
  • 6
  • 29
  • 43
0

I am not sure if you can do this in Android studio but definite can on the console. Check git reflog (https://git-scm.com/docs/git-reflog).

You can type in git reflog and check at which point you want to revert to then type in git reset 'HEAD@{1}. (replace HEAD@{1} based on the output of git reflog.

0

There are some options in VCS menu -> Git sub menu include abort rebase to undo rebase. other options are skip and continue rebase.

Reyhane Farshbaf
  • 453
  • 6
  • 12