{"id":30800,"date":"2022-07-24T13:45:16","date_gmt":"2022-07-24T13:45:16","guid":{"rendered":"https:\/\/www.devopsschool.com\/blog\/?p=30800"},"modified":"2022-12-23T05:48:06","modified_gmt":"2022-12-23T05:48:06","slug":"git-lab-exercise-assignment-remote-workflow-part-2","status":"publish","type":"post","link":"https:\/\/www.devopsschool.com\/blog\/git-lab-exercise-assignment-remote-workflow-part-2\/","title":{"rendered":"Git Lab Exercise &#038; Assignment: Remote workflow: Part &#8211; 2"},"content":{"rendered":"\n<p><strong>These exercises aim to give you some practice with using the Git version control system. Each exercise comes in two parts: a main task that most, if not all, course attendees should be able to complete in the allocated time, as well as a stretch task for those who complete the main task quickly.<\/strong><\/p>\n\n\n\n<p><br>For this task, you will work in a small group. Between 2 and 4 people is about right.<\/p>\n\n\n\n<p><strong>Main Task<\/strong><br>1. First, one person in the group should create a public repository using their GitHub account.<br>2. This same person should then follow the instructions from GitHub to add a&nbsp;<strong>remote<\/strong>, and then&nbsp;<strong>push<\/strong>&nbsp;their repository. Do not forget the<strong>&nbsp;\u2013u<\/strong>&nbsp;flag, as suggested by GitHub!<br>3. All of the other members of the group should then be added as collaborators, so they can commit to the repository also.<br>4. Next, everyone else in the group should&nbsp;<strong>clone<\/strong>&nbsp;the repository from GitHub. Verify that the context of the repository is what is expected.<br>5. One of the group members who just cloned should now make a local&nbsp;<strong>commit<\/strong>, then&nbsp;<strong>push<\/strong>&nbsp;it. Everyone should verify that when they&nbsp;<strong>pull<\/strong>, that commit is added to their local repository (use&nbsp;<strong>git log<\/strong>&nbsp;to check for it).<br>6. Look at each other\u2019s&nbsp;<strong>git log<\/strong>&nbsp;output. Notice how the SHA-1 is the same for a given commit across every copy of the repository. Why is this important?<br>7. Two members of the group should now make a&nbsp;<strong>commit<\/strong>&nbsp;locally, and race to&nbsp;<strong>push<\/strong>&nbsp;it. To keep things simple, be sure to edit different files. What happens to the runner-up?<br>8. The runner-up should now&nbsp;<strong>pull<\/strong>. As a group, look at the output of the command. Additionally, look at the&nbsp;<strong>git log<\/strong>, and notice that there is a merge commit. You may also wish to view the DAG in&nbsp;<strong>gitk<\/strong>.<br>9. Repeat the last two steps a couple of times, to practice.<\/p>\n\n\n\n<p><strong>Stretch Task<\/strong><br>1. Now create a situation where two group members both edit the same line in the same file and&nbsp;<strong>commit<\/strong>&nbsp;it locally. Race to&nbsp;<strong>push<\/strong>.<br>2. When the runner-up does a&nbsp;<strong>pull<\/strong>, they should get a merge conflict.<br>3. Look as a group at the file in conflict, and resolve it.<br>4. Use the&nbsp;<strong>add<\/strong>&nbsp;command to stage the fix, and then use commit to make the merge&nbsp;<strong>commit<\/strong>. Notice how this procedure is exactly the one you got used to when resolving conflicts in branches.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>These exercises aim to give you some practice with using the Git version control system. Each exercise comes in two parts: a main task that most, if not all, course&#8230; <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_joinchat":[],"footnotes":""},"categories":[2],"tags":[],"class_list":["post-30800","post","type-post","status-publish","format-standard","hentry","category-uncategorised"],"_links":{"self":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30800","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/comments?post=30800"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30800\/revisions"}],"predecessor-version":[{"id":30801,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/posts\/30800\/revisions\/30801"}],"wp:attachment":[{"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/media?parent=30800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/categories?post=30800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsschool.com\/blog\/wp-json\/wp\/v2\/tags?post=30800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}