![]() ![]() We have already seen git reset as above to remove the last local commit, So here we will use the same command with -hard flag and push the changes forcefully, and we will be done. $ git push origin master 2.2 Using git reset Last but not least push your commit using git push origin command. New commit message If it’s open new editor then add new commit message shown in this screenshotĪfter adding commit message you will see something like below $ git revert b212b080791fc34a9f9f5a6c881b651ccf2c59d7ġ file changed, 0 insertions(+), 0 deletions(-)ģ. # Your branch is up to date with 'origin/master'. # with '#' will be ignored, and an empty message aborts the commit. # Please enter the commit message for your changes. In case, if it will open the editor for a new commit message then you need to add your commit message and close the editor tab.Īdded new commit message as below at the last line Revert "Bad commit" So you just need to add your new commit message. It will ask you to add a new commit message in your terminal or It might open the editor. We have two commits in our branch, now let’s copy the bad commit ID and run the git revert as below. Let’s see a very simple example for better understanding.ġ. Hash commit id: It is an alphanumeric code that identifies each commit. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |