1

enter image description here

I worked on some code on Machine A. Now, it is committed to the respective branch but it is NOT merged into master yet. Now, I want to be able to clone that branch (is the term clone the branch even correct?) on Machine B and use it there.

I know that CLI can probably take me via the route git fetch or something but I need to do this via Gitlab.com GUI.

Any pointers appreciated!

bit_by_bit
  • 337
  • 2
  • 14

1 Answers1

1

Simply push the Clone button: that will clone the full repository onto your local machine.

Once cloned, you can go there and type:

git switch yourBranch

Since origin/yourBranch will have been cloned as part of the full repository history, that switch command will create automatically a local yourBranch tracking origin/yourBranch.


Don't forget, you can even do some changes directly on the Web with the Web IDE (which can switch branches as well)

See GitLab 15.10 (March 2023)

Create and switch branches in the Web IDE Beta

When you open the Web IDE Beta from a repository or merge request, the currently selected branch is used by default.

You can create a new branch with your changes or, if you’re not on a protected branch, commit to the current branch.

Starting with GitLab 15.10, you can now also create a new branch any time while making changes or switch branches in the Web IDE Beta.
This way, you can boost your productivity by not having to close the Web IDE Beta to switch contexts.

https://about.gitlab.com/images/15_10/create-web-ide-manage-branches.png -- Create and switch branches in the Web IDE Beta

See Documentation and Issue.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Yes, the Web IDE way is what I can't find any documentation for. I managed to do it using the CLI. Any pointers there? – bit_by_bit Apr 30 '20 at 17:10
  • @ankitrana_ https://docs.gitlab.com/ee/user/project/web_ide/#switching-branches is the documentation for the Web IDE: what is missing in that documentation? – VonC Apr 30 '20 at 19:13
  • If I was to use the Web IDE to switch a branch does that replicate it on my local /User/Documents/Github/ActiveBranch too or not? I've never used this but it seems like a one stop place where you can edit code, commit to branches and merge intp master from gitlab.com based IDE itself. however, I want the code from a non-merged branch to appear in my local hard-drive copy. – bit_by_bit May 01 '20 at 00:57
  • @ankitrana_ WebIDe means online only: no files on your computer. – VonC May 01 '20 at 12:24
  • @ankitrana_ "however, I want the code from a non-merged branch to appear in my local hard-drive copy. " Then clone and switch, as mentioned in my answer: the unmerged branch will be on your computer. – VonC May 01 '20 at 12:25
  • Thanks! I am going to stick with the command line for now. It helped. – bit_by_bit May 02 '20 at 03:14