Once you have initialized a new Git repository on your IBM i system, the next step is to start adding your application source code files to the repository. In this lesson, we'll cover the process of adding files to a Git repository on IBM i.
Step 1: Access the PASE Environment
If you're using Git installed in the IBM i Portable Application Solutions Environment (PASE), you'll need to access the PASE command line. You can do this by logging in to your IBM i system and running the following command:
This will take you to the PASE command prompt, where you can run Git commands.
Step 2: Navigate to the Git Repository
Navigate to the directory where you have initialized your Git repository. This is typically the directory where your IBM i application source code is located. You can use the cd
command to change directories, for example:
Step 3: Add Files to the Staging Area
To add files to the Git repository, you'll first need to stage them using the git add
command. This command tells Git that you want to include the specified files in the next commit.
You can add individual files:
Or you can add all the files in the current directory:
The .
at the end of the command tells Git to add all the files in the current directory and its subdirectories.
Step 4: Verify the Staged Files
After adding the files, you can use the git status
command to see which files have been staged and are ready to be committed:
This will show you a list of the files that have been added to the staging area, as well as any untracked files in the repository.
Step 5: Commit the Staged Files
Once you're satisfied with the files in the staging area, you can create a new commit to save the changes to the repository. Use the git commit
command to do this:
The -m
option allows you to provide a commit message, which is a good practice to help you and your team understand the changes made in each commit.
Conclusion
By following these steps, you have now added your IBM i application source code files to the Git repository on your IBM i system. You can continue to use the git add
and git commit
commands to track changes to your files as you develop your application.