Using `git checkout -b` with and without a branch starting point

I am new to Git, I want to know the difference between two commands.

`git checkout -b <branch-name>`
`git checkout -b <branch-name> origin/master`

If I execute the first command, how does Git create the branch? Will the branch be created from local master or remote master? Please help me out.


If you don't specify a starting point, the new branch is created from what you currently have checked out (the current HEAD).


git checkout -b|-B <new_branch> [<start point>]

Specifying -b causes a new branch to be created as if git-branch(1) were called and then checked out.

And git-branch:

[...] The command’s second form creates a new branch head named <branchname> which points to the current HEAD, or <start-point> if given.

Need Your Help

calabash-android how to create loops or iterate something until an exit condition?

android loops calabash

I'm trying a seat selection process for a bus. I have a seat layout with some seats booked ans some not booked. I need to select an unbooked seat. I need to create a loop by tapping random coordina...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.