質問

So, i am at my master branch working.

I issue :

git checkout -b branch1

This will create a new branch named branch1 and will make it identical to my current branch master.

Git does this "mirroring" only the first time that i run it?

Every subsequent call to git checkout will just fetch the data for the branch i checkout?

役に立ちましたか?

解決

Yes, you're correct.

When you create a new branch it is initially identical to the branch it was made from. However, once that branch has been created any calls to checkout work only against that branch. Other tools, such as merge are used to work with your new branch against any other branch.

他のヒント

Git doesn't have to fetch the data when you checkout a new branch, it already has it and has to only change the view you see on disk. When you create a new branch, there's very little to do, since with or without the branch designation the data is there already. A branch is simply a pointer to that data; when the branch is modified its pointer is moved forward.

http://git-scm.com/book/en/Git-Branching-Basic-Branching-and-Merging is a good introduction to how it works.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top