sezayir

This user hasn't shared any biographical information

Homepage: https://sezayir.wordpress.com

git revert local and remote push

Revert the full commit
Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}’

About History Rewriting
Delete the last commit
Deleting the last commit is the easiest case. Let’s say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

git push origin +dd61ab32^:master
Where git interprets x^ as the parent of x and + as a forced non-fastforward push. If you have the master branch checked out locally, you can also do it in two simpler steps: First reset the branch to the parent of the current commit, then force-push it to the remote.

git reset HEAD^ –hard

git push origin -f

Advertisements

Leave a comment

npm commands

npm install

npm update -g will apply the update

npm install –global –production windows-build-tools (Try as Administrator)

npm cache verify To run an offline verification of existing cache contents,

npm cache clean –force

npm config edit

npm config list

Leave a comment

npm cache clean gives error

npm ERR! npm cache clean

If you are afraid that there’s corruption in your cache you can ask npm to verify it manually: npm cache verify

Corrupted caches in npm@5 will be fixed when encountered at install time, but npm cache verify can sometimes save you some disk space.

And finally, if you’re sure you want to delete your cache, you can do that, the answer is in the error message: If you’re sure you want to delete the entire cache, rerun this command with –force. So that is: npm cache clean –force

Leave a comment