Adding a Git Baselibs Component: Difference between revisions

From GEOS-5
Jump to navigation Jump to search
Updates up to the Main Repo
No edit summary
 
Line 51: Line 51:
  $ git push --tags
  $ git push --tags


=== Main Repo ===
== Main Repo ==


Don't forget to then update the .gitmodules in the main ESMA-Baselibs repo to refer to the new version/<num> branch. To do this, first do a nice clean checkout of the repo for safety:
We need to add/update the <tt>.gitmodules</tt> in the main ESMA-Baselibs repo to refer to the new version/<num> branch. To do this, first do a nice clean checkout of the repo for safety:


  $ git clone --recursive git@developer.nasa.gov:mathomp4/ESMA-Baselibs.git
  $ git clone --recursive -j 4 git@developer.nasa.gov:mathomp4/ESMA-Baselibs.git


Then, you can go into it and edit <tt>.gitmodules</tt>. Once you've changed the branch to use then issue:
Then, you can go into it and edit <tt>.gitmodules</tt>. Once you've changed the branch to use then issue:


  $ git submodule update --remote <component>
  $ git submodule add -b version/1.0.1 git@developer.nasa.gov:mathomp4/ESMA-Baselibs-gFTL.git gFTL


If you have more than one, you can leave off the component and it will update all the submodules.
This should add something to the <tt>.gitmodules</tt>

Latest revision as of 10:15, 24 January 2018

Adding a Git Baselibs Component Steps

This will use gFTL as an example.

Create a new repository

On the developer Github, create a new repository named ESMA-Baselibs-gFTL.

Make directory and initialize

On your desktop, make the directory:

$ mkdir ESMA-Baselibs-gFTL
$ cd ESMA-Baselibs-gFTL
$ git init

Copy over source code and commit

$ rsync -avi --delete --exclude '.gitignore' --exclude '.git' /ford1/share/gmao_SIteam/Baselibs/Submodules/gFTL-1.0.1/ /ford1/share/gmao_SIteam/Baselibs/Submodules/ESMA-Baselibs-gFTL/
$ git add .
$ git commit -m "Add source for gFTL 1.0.1"
$ git remote add origin git@developer.nasa.gov:mathomp4/ESMA-Baselibs-gFTL.git
$ git push -u origin master

Create vendor branch

For future use, create the vendor branch now:

$ git checkout -b vendor
$ git tag -a vendor/1.0.1 -m "Tag vendor/1.0.1"

If you need to check things out, run tig to verify:

$ tig --all

Push our changes

$ git checkout master
$ git push --all
$ git push --tags

The all push moves both branches over, and the tags for the vendor tag.

Create our version tags

Because the .gitmodules file that submodules works with only accepts branches, we create a "fake" version branch, push it, and do a normal tag:

$ git branch version/1.0.1
$ git push origin version/1.0.1
$ git tag -a 1.0.1 -m "Tag version 1.0.1"
$ git push --tags

Main Repo

We need to add/update the .gitmodules in the main ESMA-Baselibs repo to refer to the new version/<num> branch. To do this, first do a nice clean checkout of the repo for safety:

$ git clone --recursive -j 4 git@developer.nasa.gov:mathomp4/ESMA-Baselibs.git

Then, you can go into it and edit .gitmodules. Once you've changed the branch to use then issue:

$ git submodule add -b version/1.0.1 git@developer.nasa.gov:mathomp4/ESMA-Baselibs-gFTL.git gFTL

This should add something to the .gitmodules