Advanced Git usage

From Geos-chem
Revision as of 16:57, 21 June 2019 by Bmy (Talk | contribs) (Created page with "__FORCETOC__ == Overview == On this page we discuss how some of the more advanced things you can do with Git. == Reverting to an older state of the code == When you clone G...")

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Overview

On this page we discuss how some of the more advanced things you can do with Git.

Reverting to an older state of the code

When you clone GEOS-Chem from the remote repository to your local disk space (with the git clone command), the master branch will point to current stable GEOS-Chem version. However, you may want to revert to an older state of the code. Git allows you to do this very easily.

Let's assume that the latest version of the code is 12.3.2 but that you want to use version 12.0.0. The procedure is as follows:

(1) Change to your local GEOS-Chem source code folder.

cd /path/to/your/GEOS-Chem/Code

(2) Start Gitk.

gitk --all &

(3) View the revision history with Gitk.

(4) Locate the commit in the revision history window corresponding to version 12.0.0. This should be marked with a yellow tag.

(5) Right-click with the mouse on the name of the commit. A context menu will appear.

(6) Select the Create new branch menu item. A dialog box will appear.

(7) Type the name of the new branch. For this example, use the name dev/12.0.0

That's it. You now have two branches:

  1. master represents the current stable version (in this example, 12.3.2)
  2. dev/12.0.0 represents GEOS-Chem version 12.0.0

Also note: Using this method, you can check out a new branch from any commit, not just those commits that correspond to GEOS-Chem releases.