Information Technology Reference
In-Depth Information
You want to create and switch branches in git. To achieve this goal you need to make a
repository as shown in Figure 5-1 . The figure presents a graph of revisions where every
dot stands for a single commit and every rounded rectangle with an arrow represents a
branch. You should take good care to create the commits in such a way that commit
messages are exactly the same as the label of a corresponding dot. Moreover, every
commit should include one new file with the name and contents based on the dot's la-
bel. A dot labeled with d2 , for example, represents a commit with comment d2 . It
should include a single file named d2.txt containing the text d2 . This method of
committing has two important features that will help you practice branching and com-
mitting:
• There are no conflicts.
• For every revision you can easily guess the contents of the working direct-
ory.
Figure 5-1 . The repository created in Recipe 5-1
When the repository shown in Figure 5-1 is finished, you want to verify that every
branch contains only the files stored in the revision as pointed to by the branch and its
ancestors.
Solution
Start the command line and create a new repository:
 
 
Search WWH ::




Custom Search