2 Before you start changing files commit your own changes locally and then

2 before you start changing files commit your own

This preview shows page 392 - 394 out of 517 pages.

2. Before you start changing files, commit your own changes locally and then merge the changes made by others while you were away. In Git, the easiest way to merge changes from the origin repo is git pull . 3. If changes cannot be automatically merged, you must manually edit the conflicted file by looking for the conflict markers in the merged file, and then commit and push the fixed version. With Git, a conflict is considered resolved when the conflicted file is re-committed. ELABORATION: Remote collaboration: fork-and-pull for public repos Git was designed to support very-large-scale projects with many developers, such as the Linux kernel. The fork-and-pull management model allows subgroups to work on independent and possibly divergent sets of changes without interfering with each others’ efforts. A remote subgroup can fork your repo , which creates their own copy of it on GitHub to receive their pushes. When they are ready to contribute stable code back to your repo, the subgroup creates a pull request asking you to merge selected commits from their forked repo back into your origin repo. Pull requests therefore allow selective merging of two repos that otherwise remain separate. Self-Check 10.4.1. True or false: If you attempt git push and it fails with a message such as “Non- fast-forward (error): failed to push some refs,” this means some file contains a merge conflict between your repo’s version and the origin repo’s version. False. It just means that your copy of the repo is missing some commits that are present in the origin copy, and until you merge in those missing commits, you won’t be allowed to push your own commits. Merging in these missing commits may lead to a merge conflict, but frequently does not. 10.5 Using Branches Effectively Besides taking snapshots of your work and backing it up, version control also lets you manage multiple versions of a project’s code base simultaneously, for example, to allow part of the team to work on an experimental new feature without disrupting working code, or to fix a bug in a previously-released version of the code that some customers are still using. Branches are designed for such situations. Rather than thinking of commits as just a sequence of snapshots, we should instead think of a graph of commits: a branch is started by creating a logical copy of the code tree as it exists at some particular commit. Unlike a real tree branch, a repo branch not only diverges from the “trunk” but can also be merged back into it. From that point on, the new branch and the one from which it was split are separate: commits to one branch don’t affect the other, though depending on project needs, commits in either may be merged back into the other. Indeed, branches can even be split off from other branches, but overly complex
Image of page 392
branching structures offer few benefits and are difficult to maintain.
Image of page 393
Image of page 394

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