Quickly Export Library Source to a New Git Repository

<< Click to Display Table of Contents >>

Navigation:  Quick Start >

Quickly Export Library Source to a New Git Repository

This section is a jump start lesson to walk you through the steps of exporting an entire library and all source files or just a single source file to a new Git repository so you can start versioning source code in Git right away.


Many customers may initially use iForGit and Git to augment their current source member backup processes to get developers out of the habit of making multiple source member copies. Git will be able to store any number of version of a single source files right from PDM or from the Rdi Remote System Explorer.


This source export step should typically only be used the first time you are exporting all source members for a library. All subsequent source commits should be done on individual source members via SRCTOGIT/SRCFRMGIT or STRSEUGIT which uses SRCTOGIT/SRCFRMGIT internally. Also check the PDM user defined options page to set up PDM options.


The source export process will create a repository structure for the source members with IFS subdirectories that mimic the source file mechanism within a library. Each source member will also receive a source information header by default so that source members can be recreated if the team moves to editing all source directly from the IFS and then pushing to source files for compilation.


1.) Make sure you have reviewed the Version your first source member tutorial so your library Git repository is set and a Git user has been configured for your IBM i user.


2.) Prompt the LIBSRCEXP command from the command line or from the IFORGIT menu. (GO IFORGIT, Option 30 - LIBSRCEXP)


LIBSRCEXP LIBRARY(QGPL)                                      















Note: Always run LIBSRCEXP with JOBQMSGFUL(*WRAP) so your job does not end abnormally if the joblog fills up.


This above command will export all source members for library QGPL, assuming the GITREPODIR and GITENABLED data areas have been set up in library QGPL (GO IFORGIT, Option 2 Set Repo Data Areas for Library)


Instead of specifying *LIBREPODTAARA to determine the Git repo name, you could also specify /gitrepos/QGPL which would create the it respository and export members to /gitrepos/QGPL and their associated source file directories. Just make sure that the GITREPODIR data area eventually gets set to the same path so the SRCTOGIT and SRCFRMGIT commands will work with the *LIBREPODTAARA setting.


Once LIBSRCEXP has completed, you can now use the SRCTOGIT and SRCFROMGIT commands or GE/GI PDM options to version source members. Or you can use the STRSEUGIT command to edit members.


You can also access your Git repository using Tortoise or other Git clients if you create a Windows share named /gitrepos or whatever you call your top level Git repo directory.


Tip: You can optionally include line seq numbers and source line dates in your source member exports although as a general recommendation we recommend NOT storing this information because with Git in use you can start using visual code diffs to see source member differences and the line seq numbers and dates make things look bad and can mess up the diffs as well. Now that you've been warned you can still choose to store line sequences and dates info if you feel you must during export and import of source members and transitioning to using Git for your source control.


3.) You can now view your local git repository by using the WRKLNK command.


Ex: WRKLNK OBJ('/gitrepos/QGPL/*') DSPOPT(*ALL) or whatever your git repository name is.