Modify-direct commit

Modifying and commit directly

we can modify and commit the files directly, without going through staging area. First let us check the status

git status
On branch master
nothing to commit, working tree clean

Modify the file(s)

let us make some simple modifications again and check status

git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   hello.txt

Let us add and commit in one command

git commit -am "hello modified again"
[master c7d349f] hello modified again
 1 file changed, 1 insertion(+), 1 deletion(-)

We cannot use this technique (add + commit) on newly created files!

Last updated