Forum Navigation
You need to log in to create posts and topics.

Clone from Different branch

Overview

Assuming you have multiple branches in you git repository for the same project and you want to clone / or update you local repo with different branch

Clone the main branch

git clone git@git.tracston.com:TracstonTeam/Product/helm-chart.git

 

Search and change to your required branch

git branch -a | grep 1.0
git branch release/V1.0
git checkout release/V1.0

Update the current branch with the latest code

git pull

and checkout to your new branch. start working on your desired branch with the code from the latest branch.

git checkout -b DEV-2001-CSV-Export-Linux release/V1.0

if it doesn’t work and you get error like this:

fatal: ‘release/V1.0’ is not a commit and a branch ‘TRK-0458-TimeZone-Setup’ cannot be created from it

Try in 2 steps:

git checkout release/V1.0
git checkout -b TRK-0458-TimeZone-Setup

Clone specific branch – another option

git clone -b <branchname> <remote-repo-url>
or
git clone –branch <branchname> <remote-repo-url>


Example:
git clone -b release/l1.0.8 git@git.tracston.com:TracstonTeam/Product/Reports.git