By: Saurav
2019-03-14 19:20:00 UTC
As OhShitGit pointed out, Programming (Including git) is...lets say.. interesting! I have fcuked up a few times myself. I do learn from mistakes I make but it sucks to be in that phase. So here are my Oh Shit moments:
#I wanted to remove a commit which had a spelling mistake, so I did git:newBranch~/projects/$ git reset <hashKey> git:newBranch~/projects$ git log #here is when I messed up: git:newBranch~/projects$ git push origin master -f #It forced pushed to the master and the last PR merge got removed (oops!) #The right thing would have been git:newBranch~/projects$ git push -f OR git push origin newBranch -f
How did I solve it?
I went to github, took the PR branch which was deleted, restored the branch so that it had all the commits. There was a new PR created on GitHub (The last PR was already approved). Then I merged it with master.
A good thing was that only the last commit to master (which was a merge branch) was removed. Otherwise I would have to go through each deleted branch and iterate the process.
Well! then I hit
asset.last.delete
If you don't know, delete only deletes the said resource from the database but doesn't run the callbacks. Destroy, on the other hand, allows cleanup methods and other actions to be run. Thus if you are using elastic search for indexing, destroy is the way to go. Below is a snapshot of documentations.
Read carefully
The search page threw an error because the elastic search was including that video while rails couldn't find it. So for a few minutes, I fcuked up the production application used by a lot of people. Thankfully, my mentor was kind enough to get back on a slack call with me and we figured a way out for the document to be removed from the elastic search index. The way was to use do_update
Owned & Maintained by Saurav Prakash
If you like what you see, you can help me cover server costs or buy me a cup of coffee though donation :)