Git

git add . -> Still “nothing to commit” With New Files

Developers add changes to the local repository in the assigned project module and then push all changes to the GitHub remote hosting service by connecting both repositories. To perform these operations, developers need to track all the added changes by executing the “$ git add –all” command to the staging area and then push them all.

This write-up will provide the easiest way of resolving the “nothing to commit” issue.

How to Resolve git add . -> Still “nothing to commit” With New Files Issue?

When the Git users tracked the changes through the “$ git add .” command, sometimes these changes are not added to the staging area. However, they exist in the repository list of content. To solve this conflict, developers need to add changes through the “$ git add –all” command.

Let’s have a look at the implementation of the above-discussed scenario!

Step 1: Navigate to Git Local Repository
First, execute the “cd” command to navigate to the required local directory:

$ cd "C:\Users\nazma\Git\Test_13"

Step 2: Generate Text File
Then, create a new text file in the working area through the “touch” command:

$ touch file4.txt

Step 3: Track Working Area Changes to Staging Index
After that, run the “git add .” command to add changes to the staging area:

$ git add .

Step 4: Check Status
View the status of the current repository by running the “git status” command:

$ git status

According to the below-provided output, the added changes are not pushed to the staging index:

Note: To resolve the above-described issues, you need to again track the changes through the “git add” along with the “–all” flag, which will add all the performed changes to the staging index:

$ git add --all

Step 5: Check Status
Lastly, run the “git status” command to view the current status of the repository and verify the added changes are tracked:

$ git status

Here, you can see the staging area contains the tracked changes:

Here you go! You have learned the easiest way to resolve the “nothing to commit” issue.

Conclusion

Sometimes, when developers push the changes using the “$ git add .” command, these are not added to the staging area but are shown in the repository content list. To solve this conflict, developers need to add changes through the “$ git –all” command. After that, check the status to verify the tracked changes. This write-up illustrated the procedure for resolving the “nothing to commit” issue.

About the author

Maria Naz

I hold a master's degree in computer science. I am passionate about my work, exploring new technologies, learning programming languages, and I love to share my knowledge with the world.