Comments:

Would you be kind enough to elaborate? Some git commands do more than one thing, and I’m not sure what origin and mynewfeature refer to. Is mynewfeature a branch name? Is origin a shortcut for a full remote repo url? Also what does the -u flag do? – CostaMar 6 ’14 at 21:16

@Costa ‘origin’ is the name of default remote in Git repository. ‘mynewfeature’ here is branch name. -uis short for --set-upstream—for what it does and why it’s needed I wouldn’t mind some explanation, too. :) – Anton StrogonoffMar 9 ’14 at 6:07

It’s also worth noting that if you have an existing tracking branch already set on the branch you’re pushing, and push.default is set to upstream, this will not do what you think it will do. It will try to push over the existing tracking branch. Use: git push -u origin mynewfeature:mynewfeature or dogit branch --unset-upstream first. – void.pointerMay 19 ’14 at 18:07

I still needed to ‘git branch –set-upstream-to origin/remote’ in order for ‘git status’ to correctly report my branch status with respect to the remote branch. – Paul WhippJul 4 ’14 at 1:17

For people using Git from Visual Studio: Actually this is that “Publish Branch” in Visual Studio does. After executing git push with -u parameter i can finally see my branch as published in VS UI. – Puterdo Borato