Clone from Different branch
Quote from moshe on 16/10/2020, 11:06 amOverview
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.0Update 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
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
Quote from moshe on 22/11/2020, 11:04 amif 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
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
Quote from moshe on 25/11/2020, 4:14 pmClone specific branch – another option
git clone -b <branchname> <remote-repo-url>
or
git clone –branch <branchname> <remote-repo-url>
Clone specific branch – another option
git clone -b <branchname> <remote-repo-url>
or
git clone –branch <branchname> <remote-repo-url>
Quote from moshe on 25/11/2020, 4:19 pmExample:
git clone -b release/l1.0.8 git@git.tracston.com:TracstonTeam/Product/Reports.git
Example:
git clone -b release/l1.0.8 git@git.tracston.com:TracstonTeam/Product/Reports.git