Delete specific versions Android Studio VCS and/or Bitbucket - android

So, I've successfully set up a Bitbucket repository and committed several versions and created several branches via Android Studio. Now, I want to clean up the commits and branches that are no longer needed. Also, I would like to do this through android studio and not the command line. I can see all my versions/branches in Bitbucket and in the Android Studio Version Control window (alt-9).
I've done quite a bit of research to accomplish this seemingly easy task and come up empty. Do I need to perform a 'delete' action in Android Studio? in Bibucket? Both? How? I could probably try to do this by trial and error, but understandably don't want to screw it up and delete necessary versions. So, I'm looking to you for some guidance.

You need to delete the remote branches on bitbucket firstly and then delete the local branch in android studio. Details as below:
Delete useless remote branches in bitbuckte. Repo in bitbucket -> Branches -> select a branch you want to delete -> click … button -> delete branch. Do the same way if you want to delete multiple branches.
Fetch changes from remote to android studio. Android studio -> VCS -> Git -> Fetch.
Delete related local branches. Android studio -> VCS -> Git -> Branches -> delete the branches both in local branches tab and remote branches tab.

Related

How to configure Android studio with gerrit commit and push

We have been using gerrit as our android source code repo. We usually use git bash
commands to do push ,pull and commit for working with gerrit.I want to how we can configure the android studio itself with gerrit so that i don't need to type in commands in git bash. I tried to change some settings in the Android studio in git version control option but that really didn't work.
One more thing is that whenever we do a commit through git commit command git creates (or something else i am sure as i am not very good at git commands and env) changeId: This is very important for pushing/amending the changes.How can i add changeId while i commit from studio.
Let me know if i am not very clear about my question , i will add more.
This is the image of my push Ui from studio where i can't see the origin HEAD :
Android Studio’s Git GUI should be able to do almost all the jobs through menus and buttons. The only annoying thing may be that you need to change the remote ref in the push menu from master or refs/heads/master to refs/for/master to create changes for review.
Change-Id is created by a hook commit-msg. As I know, it is under repo/hooks if you use Google’s REPO. The repositories cloned by repo sync have commit-msg deployed, so you don’t need to worry about it. But as for those repositories created by git clone or git init, you need to install it. Gerrit’s project page provides a clone command which includes scp that downloads and copies the hook automatically. If you clone through Android Studio, you could manually install it under .git/hooks/ for one repository, or copy it to $GITBASH/ming64(32)/share/git-core/template/hooks on Windows so that any new created repository will have it installed automatically.

How to discard local changes in Android Studio GUI?

I want to discard the local changes I made in an Android Studio project.
I tried to perform a pull, the GUI gives me 5 options, which option should I choose?
Octopus
Ours
Subtree
Recursive
Resolve
In Android Studio do the following:
-Open the Version Control tool window Alt+9 and switch to the Log tab.
-Select the recent commit and right click on it than select Reset Current Branch to Here.
-A Git Reset popup will open -> select Hard -> click Reset
You originally asked which strategy argument to use with git pull to discard your own work (there is a pending edit that will change the question, if the edit is approved). The answer is: None.
Don't use git pull at all. Run git fetch first:
git fetch origin
This brings over all the new stuff from the other Git you have your Git calling "origin".
Now that you have everything they have, simply stop using what you have been using, and switch to theirs:
git reset --hard origin/master # assuming you're on your "master"
You may also want to use git clean -fdx to remove build artifacts, but that's a separate issue.
In Android studio do the following:
Go to VCS -> Git -> Reset HEAD
Change Reset type to hard

Switching branch does not update android studio

I have a stable branch that I am doing some work on. Then to do some experimental stuff, I create another branch called experi and then started doing some work there. Then I switch back to my stable branch. However, android studio is still showing the code for the experi branch. How do I make it so that when I switch from one branch to another, android studio switches content?
I created the branch using
git checkout -b experi stable
and then to switch I do
git checkout experi
basically how do I keep the branches independent?
At least I want to be able to go back to my stable branch (before the news stuff intended for experi)
This is so weird. Everything I did was correct. But in order for the IDE to refresh I have to click on the bottom tab labeled "Version Control". It is next to the "Android Monitor" tab.
Android Studio doesn't sync with your git repo. Make sure you are on the desired branch. Note: SourceTree , AS can indicate you are on a different branch . But the command line never lies.
Synchronize your gradle and clean the project.
In Android Studio : View > Tools Windows > Gradle

Error with sharing Android Studio project with GitHub

So when I try to share my project with GitHub through Android Studio, it says I have done it successfully, and a new repository is created, but when I open the repository, it is empty. I'm pretty inexperienced with GitHub, and I have spent hours trying different things and I can't get it to work, so if someone could help point me in the right direction, I would be extremely appreciative.
Here are the steps for seamlessly working with Android Studio and github
Create a new project in Android Studio.
Create some files.
Go to VCS -> Enable Version Control Integration. Select git
Go to VCS -> Commit File and select all the files that you want to commit with a message.
Go to VCS -> Push.
Click on Define Remote.
Enter the url for the already created repository in github.
Click Push and enter the Github password.
P.S : I am using Android Studio version 1.5 If you are using some other version, then the steps can be a little different.
After creating Repository, you have to push/commit the source files to the server. It seems you have not committed any file yet.
You can use some other Git clients like Source Tree with GitHub

Bitbucket plugin can't connect in Android Studio

I recently downloaded the Bitbucket plugin for Android Studio (I'm running 1.1.0). Initially, I downloaded it from this link (https://plugins.jetbrains.com/plugin/6207?pr=phpStorm) which should be compatible with Android studio.
When I tried to clone a project in my repo, it prompted me for login credentials. I entered them, but it tells me that I can't connect to bitbucket. Then I installed the plugin from the plugin settings page seen here
I made sure that the plugin was enabled. I'm thinking this is an issue that has to do with proxy settings (I'm currently on my college campuses network, but I can connect to other VCS services like Git without problems so I doubt that's the problem).
Any suggestions?
EDIT:
Going into Bitbucket's settings and testing it shows this:
Had the same problem some time ago. Though I have not yet upgraded to 1.1, I found this implementation to work with previous version:
https://bitbucket.org/dmitry_cherkas/jetbrains-bitbucket-connector/downloads
It seems the "official" one is outdated and this one is working fine.
Please, let me know if this does work for you.
Regards
Jose
you don't really need bitbucket plugin.
Push your project to bitbucket
create a new repo in bitbucket
click on "I have an existing project" in bitbucket repo
execute these commands in Android studio Terminal to push your project to bitbucket
Checkout from Bitbucket
you can also checkout bitbucket projects giving bitbucket URL in "Checkout from GitHub" option in Android Studio
If you are still having problems (like I was recently) even though you've tried the plugin and you feel uncomfortable or not knowledgeable about initializing git for your project by hand via terminal you can use SourceTree. You will have no problems with BitBucket using source tree since both are made by Atlassian.
Once you've installed SourceTree and walked through the first boot setup process giving SourceTree your credentials you click Clone/New and a dialog will pop up. There will be the normal browse button and also a button button that looks like a globe allowing you to browse the hosted projects linked to your BitBucket account. You can also copy an paste the link from the project home on bitbucket as well. Once you've chosen the repo you want to clone, pick the destination folder and if you want to bookmark the project or not and press "clone".
Once clowning is complete you should hit the pull button to pull down the latest changes picking the appropriate branch you want to pull from. When pulling is complete you should have all the files that's on the head of that branch (master if not specified) which in most cases is an android project.
Open Android Studio and choose File->Open and browse to the folder you just pulled data to and that open the android project. Once that is done and the project is open make sure you go to VCS and you should not see "Enable Version Control Integration". If you see this that means android studio does not see the .git folder hidden in the project root (or something in that ball park....maybe it's really not in the project root). If you see git commit and git pull options then you are now using version control and bitbucket as your remote repo. Make a change to a file and you should see it turn blue specifying that changes have been made but not committed.
For more info on version control in android studio see this video https://youtu.be/Ldmc757EXaE?t=6m47s and the documentation on the intellij website.

Categories

Resources