Initializing a new Git repository

Before you can start using Git to manage your IBM i application source code, you'll need to create a new Git repository. This lesson will guide you through the process of initializing a new Git repository on your IBM i system.

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:

call qp2term

This will take you to the PASE command prompt, where you can run Git commands.

Step 2: Navigate to the Source Code Directory

Navigate to the directory on your IBM i system where you want to create the new 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:

cd /home/myuser/myapp

Step 3: Initialize the Git Repository

Once you're in the correct directory, you can initialize a new Git repository using the git init command:

git init

This will create a new .git directory in your current working directory, which will contain all the files and metadata required for your Git repository.

Step 4: Verify the Repository

After initializing the repository, you can verify that it was created correctly by running the git status command:

git status

This will show you the current status of your repository, including any untracked files.

Step 5: Add Files to the Repository

Now that you have a new Git repository, you can start adding your IBM i application source code files to it. Use the git add command to stage the files you want to include in your first commit:

git add .

This will add all the files in the current directory to the staging area, ready to be committed.

Step 6: Commit the Initial Files

Finally, you can create your first commit to save the initial state of your repository. Use the git commit command to do this:

git commit -m "Initial commit"

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 initialized a new Git repository on your IBM i system and added your initial application source code files. You can now start using Git to manage the development and evolution of your IBM i applications.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>