1

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
    master
  Remote branches:
    development new (next fetch will store in remotes/origin)
    master      tracked
  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 ?

Thanks

Chandu
  • 1,837
  • 7
  • 30
  • 51
  • What version of Git are you using? – jub0bs Feb 08 '16 at 07:50
  • This problem has been corrected in Git 1.8.4.3. See http://stackoverflow.com/a/25430727/2541573. You should update your Git installation, if possible. – jub0bs Feb 08 '16 at 09:06
  • 1
    @Jubobs (and @Chandu): note that both local and remote must be new enough (1.8.4.3 or later) so that they can use the new message to identify HEAD correctly. – torek Feb 08 '16 at 10:02

1 Answers1

0

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
LeGEC
  • 46,477
  • 5
  • 57
  • 104