One day I setup gitignore for existing project/repository, the expected result is all file/folder defined on gitignore is ignored by git when doing commit or push, but when I commit/push the code, file and folder defined on gitignore is still pushed to repository. After some google I found that git is likely caching this, and we need to delete this cache to. . . selengkapnya>>
Lately, I use gitlab for some project, but then problem happen since gitlab did not accept duplicate ssh key for deployment server, so I create other ssh key on my deployment server. After that I expect that git will work like magic and know where the new ssh key haha, but reality is not always like expectation, git did not know where the ssh key, we need to. . . selengkapnya>>
If you want to just cancel commit, you can use this script bellow :
git reset HEAD~1
But if you want to cancel and discard all changes, you can add flag --hard, this flag will also make git discard all changes you made.
git reset --hard HEAD~1
Source : https://stackoverflow.com/questions/4850717/how-to-cancel-a-local-git-commit
. . . selengkapnya>>