Section A6 summarizes the basics and Section 1010 suggests in depth resources

Section a6 summarizes the basics and section 1010

This preview shows page 389 - 391 out of 517 pages.

This section and the next one assume familiarity with basic version control practices in Git. Section A.6 summarizes the basics and Section 10.10 suggests in-depth resources. Good version control practices are even more critical for a team than for individuals. How is the repository managed? What happens if team members accidentally make conflicting changes to a set of files? Which lines in a given file were changed when, and by whom were they changed? How does one developer work on a new feature without introducing problems into stable code? When software is developed by a team rather than an individual, version control can be used to address these questions using merging and branching . Both tasks involve combining changes made by many developers into a single code base, a task that sometimes requires manual resolution of conflicting changes. Small teams working on a common set of features commonly use a shared-repository model for managing the repo: one particular copy of the repo (the origin ) is designated as authoritative, and all developers agree to push their changes to the origin and periodically pull from the origin to get others’ changes. Famously, Git itself doesn’t care which copy is authoritative—any developer can pull changes from or push changes to any other developer’s copy of that repo if the repo’s permissions are configured to allow it—but for small teams, it’s convenient (and conventional) for the origin repo to reside in the cloud, for example on GitHub or ProjectLocker. Many earlier VCSs such as Subversion supported only the shared-repository model of development, and the “one true repo” was often called the master , a term that means something quite different in Git. Team members clone the repo onto their development machines, do their work, make their commits, and push the commits to origin. 1 Roses are red, 2 Violets are blue. 3 <<<<<<< HEAD:poem.txt 4 I love GitHub, 5 ======= 6 ProjectLocker rocks, 7 >>>>>>> 77976da35a11db4580b80ae27e8d65caf5208086:poem.txt 8 and so do you. Figure 10.2: When Bob tries to merge Amy’s changes, Git inserts conflict markers in poem.txt to show a merge conflict. Line 3 marks the beginning of the conflicted region with <<< ; everything until === (line 5) shows the contents of the file in HEAD (the latest commit in Bob’s local repo) and everything thereafter until the end-of-conflict marker >>>(line 7) shows Amy’s changes (the file as it appears in Amy’s conflicting commit, whose commit-ID is on line 7). Lines 1,2 and 8 were either unaffected or merged automatically by Git.
Image of page 389
We already know that git push and git pull can be used to back up your copy of the repo to the cloud, but in the context of a team, these operations acquire additional important meanings: if Amy commits her changes to her repo, those changes aren’t visible to her teammate Bob until she does a push and Bob does a pull. This raises the possibility of a merge conflict scenario: 1. Amy and Bob each have a current copy of the origin repo.
Image of page 390
Image of page 391

You've reached the end of your free preview.

Want to read all 517 pages?

  • Spring '19
  • Dr.Marcos

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Stuck? We have tutors online 24/7 who can help you get unstuck.
A+ icon
Ask Expert Tutors You can ask You can ask You can ask (will expire )
Answers in as fast as 15 minutes
A+ icon
Ask Expert Tutors