Receiving updates (aka pulling): Difference between revisions
No edit summary |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
'''''[[Merging|Previous]] | [[Using patches to share your updates with others|Next]] | [[Guide to using Git with GEOS-Chem]] | '''''[[Merging|Previous]] | [[Using patches to share your updates with others|Next]] | [[Guide to using Git with GEOS-Chem]]''''' | ||
#[[Introduction to Git]] | |||
#[[Installing Git]] | |||
#[[First-time Git setup]] | |||
#[[Cloning (i.e. downloading for the first time)]] | |||
#[[Ignoring files]] | |||
#[[Viewing the revision history]] | |||
#[[Using Git GUI]] | |||
#[[Branching]] | |||
#[[Committing]] | |||
#[[Tagging]] | |||
#[[Merging]] | |||
#<span style="color:blue">'''Receiving updates (aka pulling)'''</span> | |||
#[[Using patches to share your updates with others]] | |||
#[[Advanced Git usage]] | |||
#[[Git and Github tutorials]] | |||
== Overview == | == Overview == | ||
Line 112: | Line 129: | ||
== Further reading == | == Further reading == | ||
# | #[https://git-scm.com/docs/git-pull ''Git pull'' (Git documentation)] | ||
#[https://www.atlassian.com/git/tutorials/syncing/git-pull ''Git pull'' (Atlassian Git tutorial)] | |||
#[https://guide.freecodecamp.org/git/git-pull/ ''Git pull'' (FreeCodeCamp)] | |||
---- | ---- | ||
'''''[[Merging|Previous]] | [[Using patches to share your updates with others|Next]] | [[Guide to using Git with GEOS-Chem | '''''[[Merging|Previous]] | [[Using patches to share your updates with others|Next]] | [[Guide to using Git with GEOS-Chem]]''''' |
Latest revision as of 20:29, 5 August 2019
Previous | Next | Guide to using Git with GEOS-Chem
- Introduction to Git
- Installing Git
- First-time Git setup
- Cloning (i.e. downloading for the first time)
- Ignoring files
- Viewing the revision history
- Using Git GUI
- Branching
- Committing
- Tagging
- Merging
- Receiving updates (aka pulling)
- Using patches to share your updates with others
- Advanced Git usage
- Git and Github tutorials
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:
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:
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 output similar to this:
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.
(7) Create a new branch off of dev/12.4.0 and start adding your code updates there.
--Bob Yantosca (talk) 16:36, 21 June 2019 (UTC)
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:
(3) Create a new branch off of master (let's call it feature/MyFeature).
(4) Check out the feature/MyFeature branch (or whatever you named it).
(5) View the revision history again. You should see something similar to this:
(6) 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.
(7) 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.
(8) At this point you can make further code edits into the feature/MyFeature branch.
--Bob Yantosca (talk) 16:35, 21 June 2019 (UTC)
Getting updates from a directory other than the remote GEOS-Chem Github repository
In some cases, you might need to pull updates from another user's GEOS-Chem source code directory. To do this, follow Steps 1-4 in the previous section.
Then type:
git pull /path/to/other/Git/repository BRANCH-NAME
This will copy the updates from BRANCH-NAME in the other user's repository into your currently checked-out branch.
--Bob Yantosca (talk) 15:08, 21 June 2019 (UTC)
Further reading