How to List Files Changed Between Two Commits in Git

When working with Git, there are times when you may want to check which files have been modified between two specific commits. A common scenario is needing to see the files changed between a particular commit with a specific message and the latest commit in your repository.

In this post, I’ll show you how to do this quickly and easily using Git commands. Let’s say you commit with messages like COMMIT_MESSAGE. Now, we want to find out what files have been changed between this commit and the latest commit (referred to as HEAD).

Step 1: Find the Commit Hash

The first step is to locate the commit that has the message COMMIT_MESSAGE. You can find this commit by using the following command:

git log –grep=”COMMIT_MESSAGE

This command will display a list of commits that have messages matching COMMIT_MESSAGE. Once you see the correct commit, take note of its hash (a long string of letters and numbers).

Step 2: List the Files Changed Between the Two Commits

After finding the commit hash, you can now list the files changed between that commit and the latest commit (HEAD) by using the following command:

git diff –name-only HASH HEAD

Replace HASH with the actual commit hash you found in the previous step. This command will list the files that have changed between the specified commit and the latest commit.

Explanation of Commands

  • git log --grep="message": This command searches through the commit history for commits that contain the given string in their commit message. The --grep option allows you to filter commits based on their message content.
  • git diff --name-only: This command compares two commits and shows the files that have been changed between them. The --name-only option limits the output to just the file names, without showing the details of the changes. If you want to see the actual differences in the files, you can run the git diff command without --name-only.

What is an SPF record and how to add it in cPanel ?

An SPF (Sender Policy Framework) record is a type of DNS (Domain Name System) record that helps prevent email spoofing and phishing by specifying which mail servers are authorized to send email on behalf of your domain. In simpler terms, it’s a way to authenticate and verify that an email sent from your domain is legitimate.

To create and add an SPF record in cPanel, follow these steps:

1. Log into cPanel: Access your cPanel account using your web hosting provider’s interface. Typically, you can access it by going to your domain URL followed by “/cpanel” (e.g., http://yourdomain.com/cpanel) and entering your login credentials.

2. Locate the “Email” Section: Inside your cPanel dashboard, find the “Email” section. Depending on your cPanel version, it may be labeled differently, but it should be something like “Email Authentication,” “Email Authentication/SPF,” or “Authentication.”

3. Access SPF Records: In the “Email” or “Email Authentication” section, you should find an option to manage SPF records. Click on it.

4. Create or Edit SPF Record: You’ll typically have two options: “Enable SPF” or “Edit SPF.” If you already have an SPF record, choose the “Edit SPF” option to make changes. If you’re setting up SPF for the first time, select “Enable SPF.”

5. Define Your SPF Record: In the next step, you’ll need to define your SPF record. You should enter a TXT record that includes the necessary SPF information. Here’s a basic SPF record example:

v=spf1 include:_spf.example.com ~all

In this example, replace “_spf.example.com” with your actual domain or your email service provider’s SPF record if you’re using one.

– `v=spf1` specifies the SPF version.
– `include:_spf.example.com` allows mail to be sent from servers listed in the “_spf.example.com” SPF record.
– `~all` indicates that the SPF policy is to soft fail, meaning that if the email doesn’t match the SPF record, it won’t be rejected but might be marked as suspicious.

6. Save the Record: After entering the SPF record, save your changes. The specific way to save the record may vary depending on your cPanel version.

7. Test the SPF Record: To ensure that the SPF record is correctly set up, you can use online SPF checking tools, such as “MXToolbox” or “SPF Record Testing Tools.” These tools will help you verify if the SPF record is configured properly.

That’s it! Your SPF record is now configured in cPanel, helping to protect your domain from email spoofing and phishing while ensuring that legitimate emails from your domain are properly authenticated.

How does ChatGPT work?

Since OpenAI hasn’t provided all the details, some parts of the diagram may be inaccurate.

We attempted to explain how it works in the diagram below. The process can be broken down into two parts (by Ali Aminian and Alex Xu).

1. Training. To train a ChatGPT model, there are two stages:

– Pre-training: In this stage, we train a GPT model (decoder-only transformer) on a large chunk of internet data. The objective is to train a model that can predict future words given a sentence in a way that is grammatically correct and semantically meaningful similar to the internet data. After the pre-training stage, the model can complete given sentences, but it is not capable of responding to questions.

– Fine-tuning: This stage is a 3-step process that turns the pre-trained model into a question-answering ChatGPT model:

1). Collect training data (questions and answers), and fine-tune the pre-trained model on this data. The model takes a question as input and learns to generate an answer similar to the training data.
2). Collect more data (question, several answers) and train a reward model to rank these answers from most relevant to least relevant.
3). Use reinforcement learning (PPO optimization) to fine-tune the model so the model’s answers are more accurate.

2. Answer a prompt

🔹Step 1: The user enters the full question, “Explain how a classification algorithm works”.

🔹Step 2: The question is sent to a content moderation component. This component ensures that the question does not violate safety guidelines and filters inappropriate questions.

🔹Steps 3-4: If the input passes content moderation, it is sent to the chatGPT model. If the input doesn’t pass content moderation, it goes straight to template response generation.

🔹Step 5-6: Once the model generates the response, it is sent to a content moderation component again. This ensures the generated response is safe, harmless, unbiased, etc.

🔹Step 7: If the input passes content moderation, it is shown to the user. If the input doesn’t pass content moderation, it goes to template response generation and shows a template answer to the user.