Committing Git Changes on IBM i Systems
In Git, a commit is a snapshot of the changes made to the files in the repository at a particular point in time. Committing changes is a crucial step in the Git workflow, as it allows you to track the evolution of your IBM i application source code over time. In this lesson, we'll cover the process of committing changes in 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 your Git repository is located. This is typically the directory where your IBM i application source code is stored. You can use the cd
command to change directories, for example:
Step 3: Stage the Changes
Before you can commit your changes, you need to stage them using the git add
command. This tells Git which files you want to include in the next commit.
You can add individual files:
Or you can add all the modified files in the current directory:
Step 4: Review the Staged Changes
After staging the changes, you can use the git status
command to see which files have been added to the staging area and are ready to be committed:
This will show you a list of the files that have been staged, as well as any untracked files in the repository.
Step 5: Commit the Changes
Once you're satisfied with the staged changes, you can create a new commit to save them 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.
Step 6: Verify the Commit
After creating the commit, you can use the git log
command to view the commit history and ensure that your changes have been properly recorded:
This will show you a list of all the commits in the repository, including the one you just created.
Conclusion
By following these steps, you have now committed changes to your Git repository on your IBM i system. Committing changes is a fundamental part of the Git workflow, and it allows you to track the evolution of your IBM i application source code over time.