Git - Make local HEAD the new master -


i decided go few commits because path followed wrong. checked out added cordova .gitignore commit, , made modifications. illustrated below :

enter image description here

now when push new modifications, error message shows :
error: src refspec (detached aad6423) not match any.

how can tell git discard previous commits (in purple) , continue local head master ?

even though don't want old branch anymore, git doesn't rewriting history or discarding changes. revert , merge.

git branch new_master              # name current detached head git checkout master                # switch master git revert --no-edit head~4..head  # create commits reverting history split git merge new_master               # merge git branch -d new_master           # don't need anymore 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -