Viewing the commit history

One of the key benefits of using Git is the ability to view the complete history of changes made to your IBM i application source code. In this lesson, we'll cover the different ways you can view the commit history in a 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 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:

cd /home/myuser/myapp

Step 3: View the Commit Log

To view the commit history of your repository, use the git log command:

git log

This will display a list of all the commits in the repository, including the commit hash, the author, the date, and the commit message.

You can also add various options to the git log command to customize the output:

  • git log --oneline: Display a more concise version of the commit log, with one commit per line.
  • git log --graph: Display the commit history in a graphical format, showing the branching and merging of the repository.
  • git log --stat: Display the files that were changed in each commit, along with the number of lines added and removed.
  • git log -p: Display the full diff (changes) for each commit.
  • Step 4: View Commit Details

    If you want to see the details of a specific commit, you can use the git show command followed by the commit hash:

    git show 1234567890abcdef

    This will display the changes made in that particular commit, including the file diffs and the commit message.

    Step 5: Search the Commit History

    You can also search the commit history using the git log command with various filters. For example, to search for commits by a specific author:

    git log --author="John Doe"

    Or to search for commits that contain a specific keyword in the commit message:

    git log --grep="Implement new feature"

    Conclusion

    By using the git log and git show commands, you can easily view the complete commit history of your IBM i application source code in your Git repository. This allows you to track the evolution of your application, understand the changes made over time, and troubleshoot issues by referencing the commit history.

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