All posts by Ankur


git log is a command in Git used to display the commit history of a repository. When run, it shows the author, date, and commit message of all commits in reverse chronological order. The latest commit appears at the top of the list.

Here’s an example:

$ git log
commit b4691c6fd3feb96eed5b51c4f9ebdd5738cde0eb (HEAD -> main, origin/main, origin/HEAD)
Author: John Doe <[email protected]>
Date:   Fri Jul 23 15:51:47 2021 -0400

    Add new feature

commit 0e94d82558f8c8ed494e7714c7bc28c41462a9e1
Author: Jane Smith <[email protected]>
Date:   Thu Jul 22 11:24:35 2021 -0400

    Update documentation

commit 3028c5a76d78f6c673296b059b452fe466305d20
Author: John Doe <[email protected]>
Date:   Wed Jul 21 09:17:26 2021 -0400

    Fix bug in login feature

In this example, the git log command lists the three most recent commits in the repository, showing the commit hash, the author, the date, and the commit message for each one.


The git status command displays information about the current status of the working directory and staging area in your Git repository. It tells you which files are currently being tracked, which changes have been staged, and which changes still need to be staged.

Let’s say you’re working on a new feature for your website and you’ve made some changes to your code. You can use git status command to see which files have been edited on your local copy:

$ git status
On branch master
Your branch is up-to-date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout --<file>..." to discard changes in working directory)
        modified:   index.html

no changes added to commit (use "git add" and/or "git commit -a")

In this example, Git is reporting that the index.html file has been modified but not yet staged. This means that Git is aware of the changes you have made, but they have not yet been added to the next commit.

I hope that helps! Let me know if you have any other questions.


The git commit command is used in Git to save changes to a local repository. It creates a new commit object with a unique identifier based on the changes made, along with a message that describes the changes. This allows you to keep track of changes made to your code over time and makes it easy to revert to previous versions if necessary.

Here’s an example of how to use git commit:

  1. After making changes to your files, add them to the staging area with git add.
  2. Once you’ve added all the changes you want to commit, run the git commit command followed by a -m flag and a message inside quotes describing the changes made. For example:
git commit -m "Added new feature to login page"

  1. The commit is now saved to your local repository with a unique identifier, allowing you to easily track and revert to previous versions of your code.

It’s important to note that committing changes locally only saves them to your local Git repository. To share the changes with others or push them to a remote repository, you’ll need to run git push after committing.

Here are some links that you may find helpful:


git add is a Git command used to stage changes made to a working directory, before committing them. Staging is an intermediate step that allows you to control which changes are included in the next commit and which are not.

Here is an example:

Suppose you made changes to two files named file1.txt and file2.txt. You want to include the changes to file1.txt in your next commit, but not the changes to file2.txt.
To do so, first navigate to the project directory in the terminal and execute:

git add file1.txt

This command stages the changes made to the file file1.txt. You can now review the changes staged by executing:

git status

You should see that file1.txt has been staged.
Now you can commit the staged changes by running:

git commit -m "Added new feature to file1.txt"

The commit will include only the changes to file1.txt since file2.txt was not staged.


git clone is a command that creates a copy of a repository, including all its branches and history, in a new directory.

Here’s an example:

git clone

This will create a copy of the repository repo owned by username on GitHub, and save it to a new directory called repo in your local machine.

You can also use git clone to clone a repository from a remote server using SSH, or to clone a specific branch.

For more information, you can check out the official Git documentation.

Apache Commons Collection – MultiValuedMap

Apache Commons Collection is a library of useful data structures, collections, and algorithms in Java. MultiValuedMap is one of the data structures present in the Apache Commons Collection. MultiValuedMap is a Map that allows multiple values for a single key. It is a useful implementation of a one-to-many relationship. You can add multiple values to the same key, and the key-value pairs are stored in the order in which they are added.

Here’s an example Java code of using MultiValuedMap:

import org.apache.commons.collections4.MultiValuedMap;
import org.apache.commons.collections4.multimap.ArrayListValuedHashMap;
public class MultiValuedMapDemo {
    public static void main(String[] args) {
        MultiValuedMap<String, String> multiValuedMap = new ArrayListValuedHashMap<>();
        multiValuedMap.put("Key1", "Value1");
        multiValuedMap.put("Key1", "Value2");
        multiValuedMap.put("Key2", "Value3");

Continue reading Apache Commons Collection – MultiValuedMap


git init is a command in Git that creates a new Git repository. It sets up all the necessary files and directories that Git needs to begin tracking changes to your project. This command creates a new subdirectory named .git that contains all of the necessary repository files.

Here is an example:

Let’s assume you have a folder on your desktop named “project”. Open a terminal/command prompt in that directory and enter git init. This will create a new subdirectory named .git in your “project” folder.

$ cd ~/Desktop/project
$ git init
Initialized empty Git repository in /Users/USER/Desktop/project/.git/

This command only needs to be run once per repository. After running git init, you can start tracking changes to your project using Git commands like git add and git commit.