0 votes
in Git by
In Git, how would you return a commit that has just been pushed and made open?

1 Answer

0 votes

One or more commits can be reverted through the use of git revert. This command, in a true sense, creates a new commit with patches that cancel out the changes introduced in specific commits. If in case the commit that needs to be reverted has already been published or changing the repository history is not an option then in such cases, git revert can be used to revert commits. If you run the following command then it will revert the last two commits:

git revert HEAD~2..HEAD

DevOps Training

Alternatively, there is always an option to check out the state of a particular commit from the past and commit it anew.

Related questions

0 votes
asked May 21, 2020 in Git by SakshiSharma
0 votes
asked Oct 16, 2019 in Git by rajeshsharma