How do i unstage a git commit?



  • Unstaging a git commit means, take it out of the staging area. The status below shows a file in the staging area, you might want to do this to re-edit it, make further changes.

    $ git status
    On branch master
    Changes to be committed:
      (use "git reset HEAD <file>..." to unstage)
    
    	modified:   README.md
    

    The output itself tells you what to do, to unstage the file.

    $ git reset HEAD README.md
    Unstaged changes after reset:
    M	README.md
    $ git status
    On branch 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:   README.md
    
    no changes added to commit (use "git add" and/or "git commit -a")
    

Log in to reply
 

© Lightnetics 2024