Category: Git

Remove last commit after push

Get commit detail git log Reset head (last commit) form local repository 1. git reset –hard HEAD~1 2. git reset –hard HEAD^ Push to remote repository for remove last commit 1. git push -f <remote> <branch> 2. git push -f Reset stage file 1. git reset –hard HEAD <path/filename> Read more →

Delete from remote repository

$ git checkout master $ git pull $ git checkout -b branchName Delete and then re-create the branchName branch #this deletes your local copy of the branch $ git branch -d branchName #this deletes the branch from the remote repository $ git push origin : branchName $ git checkout master $ git pull $ git checkout -b branchName Read more →