-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a03946
commit 06e8f14
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |