In this article we will see how to perform hard reset on a project repo.
when developer wants to rollback to previous commits we can follow the below procedure.
Here I am using the repo in gitlab.com.
Create a Sample Project
we can see the list of commits.
Now we can see how to reset the file to commit old commit:
Reset Process using command line:
Step a:
Clone project to your local
Step b:
Run git log command, it shows the list of commits.
command: git log
Step c:
Command: git reset --hard <commitID>
Step d:
push the latest commit to
remote repository.
The above issue will come
when we have enabled branch protection.
How to unprotect the Branch:
Please refer this link
After unprotecting the branch
we are able to push to Master branch.
Step e:
After hard reset now the repo is updated with respective commit.
No comments:
Post a Comment