Difference between revisions of "Receiving updates (aka pulling)"

From Geos-chem
Jump to: navigation, search
(Get all updated branches and tags from the GEOS-Chem remote repository)
(Getting updates from the GEOS-Chem repository in to a particular branch)
Line 52: Line 52:
 
=== Getting updates from the GEOS-Chem repository in to a particular branch ===
 
=== Getting updates from the GEOS-Chem repository in to a particular branch ===
  
In the previous example, we pulled all of the
+
In the previous example, we demonstrated how to pull all remote branch references into your local source code folder.  However, this is often not necessary.  Very often you will just want to pull updates into a single branch, as demonstrated below.
 +
 
 +
1.
  
  

Revision as of 14:48, 21 June 2019

Previous | Next | Guide to using Git with GEOS-Chem | Getting Started with GEOS-Chem | GEOS-Chem Main Page

Overview

On this page, we provide information about how you can get "pull" updates from the GEOS-Chem repository, or any other Git repository.

Getting updates from the GEOS-Chem repository on Github

When a new GEOS-Chem version is released, we recommend that you download it from our GEOS-Chem Github repository into a new source code folder in your disk space.

However, there may be times when patches and/or minor GEOS-Chem versions are released. These are typically done in order to fix issues in an prior GEOS-Chem version. If you already have an existing GEOS-Chem source code directory, you can receive these updates into your source code folder by using the 'git pull command, as described below.

Get all updated branches and tags from the GEOS-Chem remote repository

1. Change to your local copy of the GEOS-Chem code directory, e.g.

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

2. View the revision history with Gitk. You will see something similar to this:

GitPullStep1.png

In this example, the master branch is checked out, which corresponds to GEOS-Chem version 12.3.2.

3. Let's say that you need to add a new feature off of a development branch (say, dev/12.4.0). Pull all remote branch references into your local directory by typing:

git pull

4. View the revision history again. You should now see something like this:

GitPullStep2.png

Note that several pointers to remote branches (beginning with remotes/origin) have been added to your repository. These remote branch references "point" to branches that are present at the GEOS-Chem remote repository on Github. However, you cannot use any of these branches in your local code directory until you create local branches for them.

5. Create a local branch for dev/12.4.0 in your code directory. Type:

git checkout dev/12.4.0

You will see this text printed at the command line:

git checkout dev/12.4.0
Checking out files: 100% (173/173), done.
Branch 'dev/12.4.0' set up to track remote branch 'dev/12.4.0' from 'origin'.
Switched to a new branch 'dev/12.4.0'

6. View the revision history again. Now you will see that you have a dev/12.4.0 local branch—which is current with the state of the code at the remote repository—checked out.

GitPullStep3.png

7. Create a new branch off of dev/12.4.0 and start adding your code updates there.

Getting updates from the GEOS-Chem repository in to a particular branch

In the previous example, we demonstrated how to pull all remote branch references into your local source code folder. However, this is often not necessary. Very often you will just want to pull updates into a single branch, as demonstrated below.

1.


2. Create a new branch


  1. Make a new branch named patch (or something similar).
  2. Check out the patch branch. Now we are ready to obtain the updates from the remote server.
  3. Use the git pull command to download the updated files. Type:
      git pull origin master
  1. Try compiling GEOS-Chem and running for few time steps to make sure everything is fine.
  2. Check out the master branch.
  3. Merge the patch branch into your master branch.
  4. Delete the patch branch.

This will merge the changes from the master branch of the remote repository into your master branch.



Previous | Next | Guide to using Git with GEOS-Chem | Getting Started with GEOS-Chem | GEOS-Chem Main Page