Friday, 3 June 2022

GIT ammend commit msg && revert commit (not pushed)

ammend last commit msg :

git commit --amend

https://www.atlassian.com/git/tutorials/rewriting-history 


https://www.theserverside.com/tutorial/How-to-git-revert-a-commit-A-simple-undo-changes-example


The syntax to revert a Git commit and undo unwanted changes is simple. All developers need to do is issue the git revert command and provide the ID of the commit to undo:

git@commit /c/revert ex


$ git reflog
(HEAD -> master)
d846aa8 HEAD@{0}: commit: 5th git commit: 5 files
0c59891 HEAD@{1}: commit: 4th git commit: 4 files
4945db2 HEAD@{2}: commit: 3rd git commit: 3 files
defc4eb HEAD@{3}: commit: 2nd git commit: 2 files
2938ee3 HEAD@{4}: commit: 1st git commit: 1 file
$ git revert 4945db2

No comments:

Post a Comment