What is Git?
Git is a version control system in which you have series of snapshots of your code in order, in which you are created. You create branches of experiment and back to your snapshots. Git not only saving the branches locally, but also you can publish some branches on GitHub.
Going to show you, if you upload wrong file to Git either mistaken or not, then, how to undo or delete last comment in Git ?. There are five easily steps to follow for undo last comment in Git.
1. $ git commit -m “Something terribly misguided” .
This is for what you want to undo?.
2. $ git reset HEAD~
This is used to leaves working tree of your file on the disk.
3. << edit files as necessary >>
Here you make correction of your working tree file.
4. $ git add …
Here you can add what you would like to add in your new comment.
5. $ git commit -c ORIG_HEAD
Here you make changeof comment and if you do not want to edit the message you can use -C option instead. reusing the old commit message. reset will copy the old head to .git/ORIG_HEAD; commit with -c ORIG_HEAD will open an new text editor, that contains the log message from the old commit and allows you to edit it.
Here your code is like:
$ git commit -m “Something terribly misguided”
$ git reset HEAD~
<< edit files as necessary >>
$ git add …
$ git commit -c ORIG_HEAD