Rewind Commits
As a developer, you have been working on a project and have made several commits. However, you realize that the last few commits contain errors and you need to go back to a previous version of your code. You need to use Git to rewind your commits and get back to the previous version of your code.
Tasks
To complete this challenge, you will use the Git repository git-playground
from your GitHub account, which comes from a fork of https://github.com/labex-labs/git-playground.git
.
- Clone the repository to your local machine.
- Create a new branch called
rewind-commits
.
- View the commit history of the repository and realize that the last commit contain errors and you need to go back to the previous version of your code.
- Use Git to rewind your commits by 1.
- Verify that you have successfully rewound your commits by checking the code in your working directory.
- Push your changes to the
rewind-commits
branch.
This is the final result:
cf80005 (HEAD -> rewind-commits, origin/rewind-commits) Added file1.txt
b00b937 Initial commit