git : remote HEAD is ambiguous - how to push changes to another branch than the cloned one?
I cloned a remote rep, master and made some changes. Before pushing changes admin has created Development branch.
Now "git remote show origin" command is showing the following ambiguous HEAD branch.
HEAD branch (remote HEAD is ambiguous, may be one of the following):
development new (next fetch will store in remotes/origin)
Local branch configured for 'git pull':
master merges with remote master
Local ref configured for 'git push':
master pushes to master (up to date)
I already made changes to cloned master. Now, how to push changes to the newly created Development branch ?
If you want to have a local branch called development "linked" to the remote development branch, from your current state (eg : your master branch with extra commits), run :
# create a new branch on the current commit, and switch to it :
$ git checkout -b development
# push your moidifcations to the remote "development" branch,
# and tag your local branch to follow the remote "development" branch :
$ git push --set-upstream origin development
If you want to push to any remote branch :
git push origin mylocalbranch:remotebranch
# for example :
git push origin master:development
# if you add '-u' or '--set-upstream', your local branch will
# follow the remote branch :
git push -u origin mylocalbranch:remotebranch
Asked in February 2016Viewed 2,940 timesVoted 10Answered 1 times