Bootstrap FreeKB - Git (Version Control) - Resolve "no changes added to commit"
Git (Version Control) - Resolve "no changes added to commit"

Updated:   |  Git (Version Control) articles

Let's say you are using the git commit command to create a new commit in your branch. In this example, a new commit of foo.txt will be created.

git commit -m "example message" foo.txt

 

And the following is returned.

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

 

Use the git status command to determine if the file is ready to be committed.

git status foo.txt

 

In this example, foo.txt is not ready to be committed. This usually occurs when no changes have been made to the file.

nothing to commit (working directory clean)

 

When a new file is added to git, the following will be displayed.

new file: foo.txt

 

When a change is made to a staged or commited file, the file will be listed as modified in the git status command.

modified: foo.txt

 

The git log command can be used to view the history of commits. In this example, every commit of foo.txt will be displayed.

git log foo.txt

 

The log will display entries like this.

commit  mks910122020slsmm3lsosos020399489sl
Author: John Doe <john.doe@example.com>
Date:   Wed May 31 14:51:14 2020 -0500

  Third commitment

commit dkci85474fjfdkd9393934k49f9fk002kd01
Author: John Doe <john.doe@example.com>
Date:   Tue May 30 18:23:36 2020 -0500

  Second commitment

commit fj83m3ld0d0d3m3ld0389303l3ld0d0d39dl
Author: John Doe <john.doe@example.com>
Date:   Mon May 29 20:26:09 2020 -0500

  First commitment

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 473735 in the box below so that we can be sure you are a human.