There are two contexts in which version control is useful: private and public. You are not required to do so, however, and there is nothing special about the name “master” apart from convention, and its use as a default by some commands. The first branch in a new repository is named master by default, and it’s customary to use that name if there is only one branch in the repository, or for the branch that contains the main line of development (if that makes sense for your project). The same branches can be merged repeatedly over time, showing that they continued to progress separately while you periodically combined their contents. From time to time, you will tell Git to “merge” several branches (most often two, but there can be more), tying them together as at commit E in Figure 1-1. When you change some files and add a new commit containing the changes (called “committing to the repository”), the branch name advances to the new commit, which in turn points to the old commit as its sole parent this is the way branches move forward. Usually, you are “on” a branch, looking at the content corresponding to the tip commit on that branch. Note that branches can overlap here, commits 1 and 2 are on both the master and topic branches, and commits A and B are on all three branches. You will probably find that your understanding and command of Git will grow more easily if you do. Thus, I encourage you to take the time to read this chapter first, rather than just jump over it to the more tutorial, hands-on chapters that follow (most of which assume a basic grasp of the material presented here, in any case). By understanding up front and in reasonable detail several key points about its operation, you will be able to come up to speed with Git more quickly and confidently, and be better prepared to continue learning on your own. Git’s particular design, however, is better served by the opposite approach, in that a number of fundamental internal design decisions are reflected directly in how you use it. You concentrate first on learning to manipulate the tool the “why” and “how” can come later. Some tools and technologies lend themselves to a “black-box” approach, in which new users don’t pay too much attention to how a tool works under the hood. In this initial chapter, we discuss how Git operates, defining important terms and concepts you should understand in order to use Git effectively.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |