How to use git branch with Android Studio

chengluo

I am new to git. I have a very simple scenario for using git. I had my first release written with Android Studio. Now I want to work with some new features. What I did so far:

  1. enabled the VCS in my Android Studio
  2. created a local repository for my project from Android Studio
  3. pushed my local repository to my Bitbucket remote repository ($git push -u origin master)

Now I am confused for the next step: create a feature branch. Should I create a branch in the local repository:

$ git branch --track feature1 origin/master 

or should I create a new branch from the Bitbucket web portal, and clone the new branch?

I also want to know how I can switch branches with Android Studio? For example, switch from feature branch to master branch to work on some hotfix. Do I need to use the Bitbucket plugin to checkout the project very time from the remote repository every time I switch branches or I can hot switch it inside Android Studio?

Thanks!

Aegis

You should be able to do this directly from Android studio.

The easiest way is going to the bottom right corner of the Android Studio window where you should see the text "Git: branch name", in your case it should say "Git: master". Click on it and it will show a small menu consisting of the different branches available both locally and remotely, also there should be an option "+ New Branch" which will create a new branch for you and switch you to it.

You should then be able to change some code, commit it and push it to remote. Merging and checking out branches can also be done from that same menu. The same thing can also be done from the menubar option "VCS"

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to change git branch in Android Studio

From Dev

How can I switch the working branch (Git) in Android Studio

From Dev

How to use Git correctly in Android Studio?

From Dev

Squash Git Branch Commits in Android Studio

From Dev

Merge Local Branch with Remote Branch using Git in Android Studio

From Dev

How to use the git branch as build nr in AppVeyor

From Dev

Android Studio VCS won't push my new branch to Git

From Dev

Making the "git branch area" from Android Studio larger

From Dev

Android Studio Git move commited changes to another branch

From Dev

How to use Android studio

From Dev

How to git push to a different branch with Visual Studio Code?

From Dev

How to use git branch name of Jenkins JOB A in lower stream job B as a parameter to checkout the git branch?

From Dev

Cannot use git in Android Studio's terminal

From Dev

How can I use git branch if Im a single developer?

From Dev

How can I use git branch if Im a single developer?

From Dev

How to use a commit in git without adding it to your branch?

From Dev

Android Studio - What is this "grey git rectangle" that looks like a "git branch" in the working directory?

From Dev

how to close a branch in git

From Dev

How to fork a branch in Git?

From Dev

How to zip git branch?

From Dev

how to manage multiple android project using git branch

From Dev

Failed to use git pull for a branch

From Dev

How to use assert in Android Studio

From Dev

How to use this project in android studio?

From Java

How to use the ProGuard in Android Studio?

From Dev

How to use BoofCV in Android Studio?

From Dev

How to use BoofCV in Android Studio?

From Dev

How to use pocketsphinx in Android Studio

From Dev

How to use ObservableList in Android Studio?

Related Related

  1. 1

    How to change git branch in Android Studio

  2. 2

    How can I switch the working branch (Git) in Android Studio

  3. 3

    How to use Git correctly in Android Studio?

  4. 4

    Squash Git Branch Commits in Android Studio

  5. 5

    Merge Local Branch with Remote Branch using Git in Android Studio

  6. 6

    How to use the git branch as build nr in AppVeyor

  7. 7

    Android Studio VCS won't push my new branch to Git

  8. 8

    Making the "git branch area" from Android Studio larger

  9. 9

    Android Studio Git move commited changes to another branch

  10. 10

    How to use Android studio

  11. 11

    How to git push to a different branch with Visual Studio Code?

  12. 12

    How to use git branch name of Jenkins JOB A in lower stream job B as a parameter to checkout the git branch?

  13. 13

    Cannot use git in Android Studio's terminal

  14. 14

    How can I use git branch if Im a single developer?

  15. 15

    How can I use git branch if Im a single developer?

  16. 16

    How to use a commit in git without adding it to your branch?

  17. 17

    Android Studio - What is this "grey git rectangle" that looks like a "git branch" in the working directory?

  18. 18

    how to close a branch in git

  19. 19

    How to fork a branch in Git?

  20. 20

    How to zip git branch?

  21. 21

    how to manage multiple android project using git branch

  22. 22

    Failed to use git pull for a branch

  23. 23

    How to use assert in Android Studio

  24. 24

    How to use this project in android studio?

  25. 25

    How to use the ProGuard in Android Studio?

  26. 26

    How to use BoofCV in Android Studio?

  27. 27

    How to use BoofCV in Android Studio?

  28. 28

    How to use pocketsphinx in Android Studio

  29. 29

    How to use ObservableList in Android Studio?

HotTag

Archive