Skip to content

Make Selenium Easy

And Keep It That Way

  • Home
  • Share
  • Toggle search form

Git Tutorial 7 – Git Commit – Save Staging Directory Changes To Local Repository

Posted on 02/19/2025 By admin

As a part of GIT Tutorials End To End, we will learn about another frequently used and important git command “git commit“ in this post.

We have already encountered the word “commit” in previous posts mainly when we run “git status” command but we did not understand that well. Let’s learn about it in detail in this post.

Did you know that I have started a YouTube channel as well and I need your support to make it successful. Please do watch content then comment, like, share, and obviously subscribe.

If you have followed the previous posts in sequence then you must have added changes from the working directory to the staging area using “git add” command. Once we reach that step or we have staged changes (after using git add command) then we need to use git commit command.

We already know from the previous post that As per Atlassian  "git add” is the first command in a chain of operations that directs Git to “save” a snapshot of the current project state, into the commit history. Now we can say that “git commit” is the second command in above chain of operations.

The git commit command captures a snapshot of the project’s currently staged changes and creates a new commit. Please note this snapshot is committed to the local repository. I mean if we have a central repository like BitBucket etc, assosiated with the project then the commit will not push changes to the central repository automatically. You can always make changes to committed snapshots. We can have multiple commits and can refer always what was project’s status at a particular commit.

Let’s learn git commit command in action.

  1. Create an empty directory.
  2. Right-click and click on Git Bash Here.
  3. Type a git command as “git init“.
  4. Type “git status” command.
  5. Create a new file and add some content to it.
  6. Type “git status” command.
  7. Type “git add ” command.
  8. Type “git status” command.

The above steps I have covered well in my previous posts. Now we will perform git commit. Let’s execute “git commit -m ” command. As we already know that git commit command creates a snapshot of the project’s currently staged changes and we can have multiple commits so we should provide a commit message which can help us to identify them. It is a kind of label that we give to each commit.

As we have added a file “myFile1.txt” so I have given a meaningful commit message. As git commit command already committed currently staged changes, the output of git status command shows that the working tree is clean. If we rerun the same git commit again it will not perform anything.

We can use the duplicate commit message as well but kindly give it unique so that you can understand the changes. Let’s add another line in the existing file and make a commit.

You need to add modified files tracked by git again.

We will see more about git commit in upcoming posts.

Please subscribe to my YouTube channel Retarget Common to learn from my video tutorials.

Below are important end to end tutorials for Testers:-

Selenium Tutorials

Rest Assured Tutorials

Postman Tutorials

TestNG Tutorials

If you have any doubt, feel free to comment below.If you like my posts, please like, comment, share and subscribe.#ThanksForReading

#HappyLearning

Uncategorized

Post navigation

Previous Post: Learn About Less Talked & Used XPath Function – concat()
Next Post: XPath Method – string() – Usage in Locating Element- How it is Different From text()

Related Posts

Reading Data From CSV in Postman Uncategorized
April 2019 – Make Selenium Easy Uncategorized
amod mahajan rest assured Uncategorized
Hierarchy of Selenium Classes and Interfaces – Make Selenium Easy Uncategorized
July 7, 2018 – Make Selenium Easy Uncategorized
image – Make Selenium Easy Uncategorized

Recent Posts

  • Getting Started with Selenium 4: What Is New and How to Upgrade from Selenium 3
  • Manual Testing
  • Baby Steps To Become Efficient Selenium-Java Automation Tester
  • Features of Selenium 4.0.0 Release – Java Binding
  • Part 1: Handling Drop-down Created Using SELECT Tag In Selenium

Recent Comments

No comments to show.

Archives

  • April 2026
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • April 2024
  • March 2024
  • February 2024
  • December 2023
  • October 2023
  • August 2023
  • November 2022
  • September 2022
  • August 2022
  • July 2022
  • May 2022
  • March 2022
  • October 2021
  • April 2021
  • March 2021
  • January 2021
  • December 2020
  • October 2020
  • September 2020
  • August 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • January 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • May 2019
  • December 2018
  • November 2018
  • October 2018
  • September 2018
  • August 2018
  • July 2018
  • January 2018

Categories

  • Getting Started
  • Uncategorized

Copyright © 2026 Make Selenium Easy.

Powered by PressBook Masonry Dark