You can create a new branch called my-work
(based on the current commit) and switch to this branch with:
git branch my-work git checkout my-work
Or, as a shortcut to these two commands, you can simply do:
git checkout -b my-work
To drag this branch into a cloned repository, you must do:
git push origin my-work
origin
is an alias for the repository you cloned. It is known as "remote", in git terminology. Update: clarification due to a useful comment by Michael Minton: this will push your my-work
branch to a branch called my-work
in the remote repository, creating it if necessary - if you had something else in mind, it would be better to edit Your question is to clarify this point.
The first time you run this push command, you might want to make git push -u origin my-work
, which sets the configuration parameters that make the my-work
branch in the origin
repository considered as the default upstream branch for your my-work
branch. (You donβt need to worry about this if you are new to git, but that would mean that git provides more useful status information, and various commands have more useful default actions.)
source share