[GRASS-dev] git: how to switch between branches?
Markus Neteler
neteler at osgeo.org
Sun May 19 10:27:34 PDT 2019
Hi,
being a kind of git newbie, I'm struggly with switching between the
different release branches (and master).
Starting from a clean state (nothing downloaded yet), it this correct:
## 0. getting the code: fork in GH, then
# git clone git at github.com:your_GH_account/grass.git
# git remote ...
Now I want the each release branch in a separate directory (!) as I
keep the compiled binaries and run GRASS directly from there.
# make a local copy of the freshly cloned source code (example: relbranch76(:
cp -rp grass grass76_branch
cd grass76_branch/
## 1. preparation: check if the local branch-copy of the remote branch exists
git branch -a
# if yes:
# nothing to do, continue below
# if not:
# create a new local branch that tracks a remote branch
git checkout --track upstream/releasebranch_7_6
## ?? or
## git checkout --track remotes/upstream/releasebranch_7_6
# check
git branch -a
## 2. subsequently, switching between master and branch
# switch to branch, e.g.
git checkout upstream/releasebranch_7_6
# back to master
git checkout master
Please suggest, at non-git-expert level :-)
Markus
More information about the grass-dev
mailing list