git - How to create branch and push to server -


i have cloned project repo , need create branch , in branch changes. after need push branch on repo. how ? sorry, new git ?

you can create new branch called my-work (based on current commit) , switch branch with:

git branch my-work git checkout my-work 

or, shortcut 2 commands, can do:

git checkout -b my-work 

to push branch repository cloned from, should do:

git push origin my-work 

origin nickname repository cloned from. it's known "remote", in git terminology. update: clarification due michael minton's helpful comment above: push my-work branch branch called my-work in remote repository, creating if necessary - if meant different, best edit question clarify point.

the first time push command, may want git push -u origin my-work, sets configuration options make branch my-work in origin repository considered default "upstream" branch my-work branch. (you don't need worry moment if you're new git, mean git provides more helpful status information , various commands have more useful default actions.)


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -