I confused to push all file codes include lib file which is in .gitignore in android studio. How can we undo git push file without changing the local code. I am afraid, my new local code is omitted if I reset Head.
I am very new with git. Please help and thank.
Just "backup" your current HEAD for example like this:
git tag tmptag git reset --hard HEAD^ git push --force git reset --hard tmptag git tag --delete tmptag
BTW don't be afraid. It's difficult to really remove commits by mistake. Usually you always see all recent commits using
git reflog. Instead of creating such backup tag like I mentioned above, you could just reset the branch to the old original sha1 hash even if no existing branch or tag has this commit in the history anymore. You could even use the special identifier
ORIG_HEAD without copy/pasting any sha1 hash at all.