Adding a Git Baselibs Component: Difference between revisions

m Copied from Updating a Git Baselibs Component, revision 4103
 
Updates up to the Main Repo
Line 1: Line 1:
== Updating a Git Baselibs Component Steps ==
== Adding a Git Baselibs Component Steps ==


This will use cURL as an example.
This will use gFTL as an example.


=== Clone component (if not cloned) ===
=== Create a new repository ===


First, clone the component:
On the developer Github, create a new repository named <tt>ESMA-Baselibs-gFTL</tt>.


$ git clone git@developer.nasa.gov:mathomp4/ESMA-Baselibs-curl.git
=== Make directory and initialize ===
$ cd ESMA-Baselibs-curl


=== Update component (if cloned already) ===
On your desktop, make the directory:


  $ git remote update
  $ mkdir ESMA-Baselibs-gFTL
  $ git pull (if necessary)
$ cd ESMA-Baselibs-gFTL
  $ git init


=== Work on vendor branch ===
=== Copy over source code and commit ===


Next, move to the vendor branch:
  $ 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 checkout vendor
$ git commit -m "Add source for gFTL 1.0.1"
 
$ git remote add origin git@developer.nasa.gov:mathomp4/ESMA-Baselibs-gFTL.git
(Note, if '''vendor''' doesn't exist yet, make it with <tt>git checkout -b vendor</tt>)
$ git push -u origin master
 
=== Move to new code ===
 
Synchronize the code:
 
  $ rsync -avi --exclude '.gitignore' --exclude '.git' /ford1/share/gmao_SIteam/Baselibs/Submodules/curl-7.53.1/ /ford1/share/gmao_SIteam/Baselibs/Submodules/ESMA-Baselibs-curl/
 
Now, this can be dangerous. If you know some files need to be kept because of patches, then <tt>--exclude</tt> them or copy them away and restore. The next thing to do is to make sure things are the same/similar:


$ xxdiff -r /ford1/share/gmao_SIteam/Baselibs/Submodules/curl-7.53.1/ /ford1/share/gmao_SIteam/Baselibs/Submodules/ESMA-Baselibs-curl/
=== Create vendor branch ===


Examine that. If files or directories need to be deleted, you can either re-run the above rsync with <tt>--delete</tt>, or do so manually.
For future use, create the vendor branch now:


=== Commit to vendor ===
  $ git checkout -b vendor
 
  $ git tag -a vendor/1.0.1 -m "Tag vendor/1.0.1"
Once you are satisfied that the code is correct, commit and tag:
 
$ git add .
  $ git commit -m 'Update cURL to 7.53.1'
  $ git tag -a vendor/7.53.1 -m "Tag vendor/7.53.1"


If you need to check things out, run <tt>tig</tt> to verify:
If you need to check things out, run <tt>tig</tt> to verify:
Line 47: Line 34:
  $ tig --all
  $ tig --all


=== Merge to master ===
=== Push our changes ===
 
Now merge to master:


  $ git checkout master
  $ git checkout master
$ git merge vendor
=== Push our changes ===
  $ git push --all
  $ git push --all
  $ git push --tags
  $ git push --tags
Line 65: Line 46:
Because the .gitmodules file that submodules works with only accepts branches, we create a "fake" version branch, push it, and do a normal tag:
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/7.53.1
  $ git branch version/1.0.1
  $ git push origin version/7.53.1
  $ git push origin version/1.0.1
  $ git tag -a 7.53.1 -m "Tag version 7.53.1"
  $ git tag -a 1.0.1 -m "Tag version 1.0.1"
  $ git push --tags
  $ git push --tags