Skip to content

Commit

Permalink
adding new post
Browse files Browse the repository at this point in the history
  • Loading branch information
MAInformatico committed Jul 18, 2022
1 parent 2a03946 commit 06e8f14
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions _posts/2022-7-18-GitRevert.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
layout: post
title: How can I revert a commit in git
author: Migue
---
Imagine, you have completed your task successfully. All the tests work properly without problems at the first time (Remember, I have said: 'Imagine' :D ) and you perform a commit into team repo's git.
However you find an issue in your code and your code has been commited in the repo. Ok, Relax! you can fix it!

Git allow us to fix these kind of issues using the command:
`git revert <your last commit code>`
This command allow us to remove our last commit, in case of our commit has been commited.

* If we have not commited our changes
You can revert the change using this command:
`git reset --soft HEAD~1` (if you wish to keep your changes)
or
`git reset --soft HEAD~1` (if you do not want to keep your changes)

I hope these commands can be helpfull for you, specially on those moments that we feel stressed by a mistake.

> "Memento mori"

0 comments on commit 06e8f14

Please sign in to comment.