git revert
Reverts the changes made in a specific commit by creating a new commit that undoes those changes.
echo "This is the initial content." > myfile.txt
add and commit file
git add myfile.txt
git commit -m "Initial commit"
make changes
echo "This is the modified content." > myfile.txt
git add myfile.txt
git commit -m "Modified myfile.txt"
revert last commit
git revert HEAD
or we can use specifying with the commit ID
git revert 4c04ecc
git log will return
 Revert "added file 4" --- Commit name

    This reverts commit 4c04eccff32e195ac0df17b1543f7f81de32d938. --- Commit id
by Luka Tatarishvili
12 months ago
Git
commands
3
Pro tip: use ```triple backticks around text``` to write in code fences