Version Control
Git: Getting started
Git: Getting started
  • Introduction
    • What is version control
      • Distributed VCS
      • Summary
    • What is Git?
      • A Short History of Git
      • Under the hood
      • The Three States
    • What is GitHub?
  • Setting up Git
    • Installation
    • First time setup
    • Creating a repo
  • Basic operations
    • Recording Changes
      • Add another file
      • Modify-stage-commit
      • Modify-direct commit
      • View log
    • Undo changes
      • Restore (modified)
      • Restore (staged)
      • Amend (rare)
    • Clone repos
  • Remote Repos
    • Configure remote
    • Push to remote
      • Push branches
  • Reference
    • My Git Tutorials
    • Git Official
    • Others
Powered by GitBook
On this page
  • Modifying and commit directly
  • Modify the file(s)
  1. Basic operations
  2. Recording Changes

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!

PreviousModify-stage-commitNextView log

Last updated 2 years ago