You may choose to work on class assignments on your own personal device rather than on EWS machines. However, you should always verify that your submission works on EWS machines because the EWS environment is used by the auto-grader. If you do decide to use your own machine, you will have to learn how to pull your own code from your class repository and how to resolve potential merge conflicts.
Suppose that you have cloned your repository on both your EWS account and your personal device. At some point, you may have made edits and pushed these edits from one of the machines and wish to work on the other machine. To do so, you will first need to pull the changes from your class repository:
git pull origin main
This will bring in the edits you made from the other machine unto the current machine.
If there were any changes in the repository on your current machine, then Git may tell you that there are merge conflicts. To see the merge conflicts, run:
git status
There will be a list of files under the heading Unmerged paths
for any merge conflicts. For each merge conflict, do the following:
Open the file in a text editor
Find the lines with conflicts. Git places markers around these lines. For example:
<<<<<<< HEAD
i += 1;
=======
i += 2;
>>>>>>> origin/main
You can see the changes in HEAD or base branch after <<<<<<< HEAD
. The =======
separates the remote changes your trying to pull from the local conflicting changes. The >>>>>>> origin/main
marks the end of the conflicting changes.
Decide which of the changes you want to keep, if any. In the above example, we can include both changes and replace the 6 lines above with:
i += 3;
Please note that you should remove the markers placed by git (<<<<<<< ..., =======, >>>>>>> ...
).
Each file may have multiple conflicts. Repeat steps second and third steps until you cannot find <<<<<<<
in your file.