in Technology by

Is there a way to revert a git commit that’s already been pushed and made public?

1 Answer

0 votes
by

 Yes, to fix or revert a bad commit, there are two approaches that can be used based upon the scenario.

They are:

  1. The very obvious way is to make a fresh commit where you remove the bad file or fix the errors in it. Once done, you can push it to a remote repository.
  2. Another approach is to create a new commit to undo all changes that were done in the previous bad commit. This can be done through git revert command – “git revert <name of bad commit>”

Related questions

0 votes
    In Git how do you revert a commit that has already been pushed and made public?...
asked Nov 2, 2020 in Technology by JackTerrance
0 votes
    What is the process for reverting a commit that has already been pushed and made public?...
asked Oct 4, 2020 in Technology by Editorial Staff
0 votes
    How to revert a Git repository to a previous commit?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    How do I revert from my current state to a snapshot made on a certain commit? If I do git log, then I get ... , i.e. commit 0d1d7fc? Select the correct answer from above options...
asked Jan 30, 2022 in Education by JackTerrance
0 votes
    How to Undo a Git merge that hasn't been pushed yet?...
asked Jan 7, 2021 in Technology by JackTerrance
0 votes
    How will you find out what all files have been changed in a particular Git commit?...
asked Nov 4, 2020 in Technology by JackTerrance
0 votes
    I have made a commit and discarded it. I can still retrieve that commit using git reflog. A. True B. False...
asked Dec 24, 2022 in Education by JackTerrance
0 votes
    A bundled package is a package that's been compressed into a ______ file. (a) Double (b) Triple (c) ... Regression of R Programming Select the correct answer from above options...
asked Feb 10, 2022 in Education by JackTerrance
0 votes
    I'm currently working on a project converting some training materials from one e-learning system to another, ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    I have a simple command line tool that fetches preview images from a remote location and uploads to ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    Consider a list2 with values 70,60,50. What will be the output statements considering that the above object has ... print(list2*3) Select the correct answer from above options...
asked Dec 29, 2021 in Education by JackTerrance
0 votes
    I have made some changes to a file that has been committed a few times as part of a group of files, but ... former state in the past Select the correct answer from above options...
asked Jan 31, 2022 in Education by JackTerrance
0 votes
    How do you find a list of files that have been changed in a particular commit?...
asked Oct 4, 2020 in Technology by Editorial Staff
0 votes
    The _______________ policy, allows a transaction to commit even if it has modified some blocks that have ... Buffer Management in chapter Recovery System of Database Management...
asked Oct 10, 2021 in Education by JackTerrance
0 votes
    Recently, it has been made compulsory in India and some other countries to mix 10% ethanol with ... ,Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 7, 2021 in Education by JackTerrance
...