[GRASS-dev] git: how to switch between branches?


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Head, Graduate Faculty in Complex Adaptive Systems Science
Arizona State University

Currently Senior Research Fellow, Institute for Advanced Sustainability Studies
Potsdam, Deutchland

voice: 480-965-6262 (SHESC), 480-965-8130/727-9746 (CSDC)
fax: 480-965-7671 (SHESC), 480-727-0709 (CSDC)
www: http://www.public.asu.edu/~cmbarton, http://csdc.asu.edu

I have similar questions.

Related to this, when we set up our MedLanD project Git repository, we also had some colleagues suggest using Git’s forking to deal with collaborative development. But in the end, we decided to follow more of the previous GRASS SVN approach. It relies more on good practice among developers, but it is easier to remember how to carry out the good practices.

Michael

On May 20, 2019, at 3:00 AM, grass-dev-request@lists.osgeo.org wrote:

Date: Sun, 19 May 2019 19:27:34 +0200
From: Markus Neteler <neteler@osgeo.org>
To: GRASS developers list <grass-dev@lists.osgeo.org>
Subject: [GRASS-dev] git: how to switch between branches?
Message-ID:
<CALFmHhvwDZHOqU07Q8s12qN10qMmgQdAvVYdpjCRKTYxZhcPig@mail.gmail.com>
Content-Type: text/plain; charset=“UTF-8”

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@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 :slight_smile:

Markus