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

From Geos-chem
Jump to: navigation, search
(Getting updates from the GEOS-Chem repository in to a particular branch)
(Getting updates from the GEOS-Chem repository on Github)
Line 13: Line 13:
 
=== Get all updated branches and tags from the GEOS-Chem remote repository ===
 
=== 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.
+
1. '''Change''' into your local GEOS-Chem code directory.
  
 
  cd /path/to/my/GEOS-Chem/Code
 
  cd /path/to/my/GEOS-Chem/Code
Line 54: Line 54:
 
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.
 
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.  
+
1. '''Change''' into your local GEOS-Chem code directory.
  
 +
cd /path/to/my/GEOS-Chem/Code
 +
 +
2. [[Viewing_the_revision_history#Use_Gitk_to_see_a_graphical_display|'''View the revision history with Gitk''']].  You will see something similar to this:
 +
 +
[[Image:GitPullStep1.png]]
 +
 +
3. [[Branching#Creating_branches|'''Create a new branch''']] off of '''master''' (let's call it '''feature/MyFeature''') and [[Branching#Switching_between_.28aka_.22checking_out.22.29_branches|'''check out this branch''']].
 +
 +
4. [[Viewing_the_revision_history#Use_Gitk_to_see_a_graphical_display|'''View the revision history''']] again.  You should see something similar to this:
 +
 +
[[Image:GitPullStep4.png]]
 +
 +
5. '''Pull a branch from the remote GEOS_Chem repository into the '''feature/MyFeature''' branch:
 +
 +
git pull origin dev/12.4.0
 +
 +
You will see text similar to this:
 +
 +
From github.com:geoschem/geos-chem
 +
  * branch              dev/12.4.0 -> FETCH_HEAD
 +
Updating 8577e970..93e8ad81
 +
Checking out files: 100% (173/173), done.
 +
Fast-forward
 +
  GeosCore/Makefile                          |  14 +-
 +
  GeosCore/RnPbBe_mod.F                      |  33 +-
 +
  ...etc. -- this is the list of files that are being modified ...
 +
173 files changed, 12105 insertions(+), 17449 deletions(-)
 +
 +
Here, '''git pull origin''' means to pull the updates from the same repository that your GEOS-Chem source code folder was cloned from.  This will almost always be the GEOS-Chem Github repository.
 +
 +
4. [[Viewing_the_revision_history#Use_Gitk_to_see_a_graphical_display|'''View the revision history''']] again.  You will see that the '''feature/MyFeature''' branch is now at the same commit as the '''dev/12.4.0''' branch.
 +
 +
[[Image:GitPullStep5.png]]
  
2. '''Create a new branch
+
5. At this point you can make further code edits into the '''feature/MyFeature''' branch.
  
 +
=== Getting updates from a directory other than the remote GEOS-Chem Github repository ===
  
# [[#Creating branches|Make a new branch]] named '''patch''' (or something similar).
+
In some cases, you might need to pull updates from  
# [[#Creating branches|Check out]] the '''patch''' branch.  Now we are ready to obtain the updates from the remote server.
+
# Use the '''git pull''' command to download the updated files. Type:
+
      git pull origin master
+
# Try compiling GEOS-Chem and running for few time steps to make sure everything is fine.
+
# [[#Creating branches|Check out]] the '''master''' branch.
+
# [[#Merging|Merge]] the '''patch''' branch into your '''master''' branch.
+
# [[#Deleting branches|Delete]] the '''patch''' branch.
+
  
This will merge the changes from the '''master''' branch of the remote repository into your '''master''' branch.
+
== Further reading ==
  
 +
#TBD
  
 
----
 
----
 
'''''[[Merging|Previous]] | [[Sharing updates with patches|Next]] | [[Guide to using Git with GEOS-Chem]] | [[Getting Started with GEOS-Chem]] | [[Main Page|GEOS-Chem Main Page]]'''''
 
'''''[[Merging|Previous]] | [[Sharing updates with patches|Next]] | [[Guide to using Git with GEOS-Chem]] | [[Getting Started with GEOS-Chem]] | [[Main Page|GEOS-Chem Main Page]]'''''

Revision as of 15:03, 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 into your local GEOS-Chem code directory.

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. Change into your local GEOS-Chem code directory.

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

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

GitPullStep1.png

3. Create a new branch off of master (let's call it feature/MyFeature) and check out this branch.

4. View the revision history again. You should see something similar to this:

GitPullStep4.png

5. Pull a branch from the remote GEOS_Chem repository into the feature/MyFeature branch:

git pull origin dev/12.4.0

You will see text similar to this:

From github.com:geoschem/geos-chem
 * branch              dev/12.4.0 -> FETCH_HEAD
Updating 8577e970..93e8ad81
Checking out files: 100% (173/173), done.
Fast-forward
 GeosCore/Makefile                          |   14 +-
 GeosCore/RnPbBe_mod.F                      |   33 +-
 ...etc. -- this is the list of files that are being modified ...
173 files changed, 12105 insertions(+), 17449 deletions(-)

Here, git pull origin means to pull the updates from the same repository that your GEOS-Chem source code folder was cloned from. This will almost always be the GEOS-Chem Github repository.

4. View the revision history again. You will see that the feature/MyFeature branch is now at the same commit as the dev/12.4.0 branch.

GitPullStep5.png

5. At this point you can make further code edits into the feature/MyFeature branch.

Getting updates from a directory other than the remote GEOS-Chem Github repository

In some cases, you might need to pull updates from

Further reading

  1. TBD

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