From 272aef0e7f8a16a84882e650e29eb5460826d430 Mon Sep 17 00:00:00 2001 From: RMarx1456 Date: Thu, 3 Oct 2024 14:23:24 -0700 Subject: [PATCH 1/5] Hello 2nd line --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 437e760..6abaa27 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # grcsay +Hello An exercise for collaborating with git / GitHub. Please read the directions CAREFULLY! I recommend focusing on the changes to the README before reading the Java code. ## Setting up git merging strategy From 99325cd3856f8cca3c554bf1fc640662f789ccf7 Mon Sep 17 00:00:00 2001 From: Zachary Springer Date: Thu, 3 Oct 2024 14:25:43 -0700 Subject: [PATCH 2/5] A change was made --- README.md | 155 +++++++++++++++++++++++++++++------------------------- 1 file changed, 83 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index 6abaa27..ff6ae68 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,21 @@ # grcsay + Hello An exercise for collaborating with git / GitHub. Please read the directions CAREFULLY! I recommend focusing on the changes to the README before reading the Java code. ## Setting up git merging strategy + 1. Each partner should run these commands on their own terminal. DO NOT SKIP THIS PART!!! - ``` - git config --global pull.ff true - git config --global pull.rebase false - ``` - This will tell git to perform fast forwards when possible, never rebase, and create merge commits when necessary. We will not cover the differences between these in-depth in class, but feel free on your own time to research them using search engines or AI if you're interested. Explore your curiosity! + ``` + git config --global pull.ff true + git config --global pull.rebase false + ``` + This will tell git to perform fast forwards when possible, never rebase, and create merge commits when necessary. We will not cover the differences between these in-depth in class, but feel free on your own time to research them using search engines or AI if you're interested. Explore your curiosity! + +I have made a change here ## Setup project + 1. Choose one partner to be Partner A, one partner to Partner B. 1. Have ONLY Partner A fork this repository. PARTNER B SHOULD NOT FORK. 1. Have Partner A add Partner B as a collaborator on their fork. Follow [these directions](https://docs.github.com/en/enterprise-server@3.10/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-access-to-your-personal-repositories/inviting-collaborators-to-a-personal-repository#inviting-a-collaborator-to-a-personal-repository). @@ -18,106 +23,111 @@ An exercise for collaborating with git / GitHub. Please read the directions CARE 1. Partner B should see an invitation at the top of the repository. Click "View Invitation", then "Accept Invitation". 1. Both partners should clone the repository to their own computer. The URL should include Partner A's username. 1. Both partners should change into the project repository: - ``` - cd grcsay - ``` + ``` + cd grcsay + ``` 1. Both partners should open VSCode in the project repository. If the below command does not work, open VS Code and use File > Open Folder. - ``` - code . - ``` + ``` + code . + ``` ## Making a change to the README + We will first practice making changes that do not trigger a merge conflict. In general, this is what we hope to happen! + 1. Partner A will make changes first. ONLY PARTNER A SHOULD DO THESE SUB STEPS to add, commit, and push the changes. - 1. Do a git pull. You should get a message saying you're up to date. - ``` - git pull - ``` - 1. Make any change to the README and save it. - 1. Check that the change shows up in red (shows as unstaged) when asking for the status. - ``` - git status - ``` - 1. Add (stage) the change. - ``` - git add README.md - ``` - 1. Check that the change shows up as green (staged for commit). - ``` - git status - ``` - 1. Commit the change. Change the commit message to describe your commit. - ``` - git commit -m "DESCRIBE YOUR CHANGE HERE" - ``` - 1. Push the changes to GitHub - ``` - git push origin - ``` + 1. Do a git pull. You should get a message saying you're up to date. + ``` + git pull + ``` + 1. Make any change to the README and save it. + 1. Check that the change shows up in red (shows as unstaged) when asking for the status. + ``` + git status + ``` + 1. Add (stage) the change. + ``` + git add README.md + ``` + 1. Check that the change shows up as green (staged for commit). + ``` + git status + ``` + 1. Commit the change. Change the commit message to describe your commit. + ``` + git commit -m "DESCRIBE YOUR CHANGE HERE" + ``` + 1. Push the changes to GitHub + ``` + git push origin + ``` 1. Go to Partner A's fork on GitHub. Refresh the page and verify the changes show up. 1. Have Partner B pull Partner A's change. ONLY PARTNER B SHOULD DO THIS: - ``` - git pull - ``` + ``` + git pull + ``` 1. Verify that the changes are downloaded locally to Partner B's computer. At this point, the code on both computers should be exactly the same. 1. Have ONLY Partner B now make a change to the README. Partner B should add, commit, and push the change following the above steps. 1. Have Partner A pull partner B's changes. Verify that the changes are downloaded locally to Partner B's computer. At this point, the code on both computers should be exactly the same again. ## Triggering a merge conflict + We will now artificially trigger a merge conflict. When we follow good git practices (small, frequent commits, pulling frequently) these won't happen as often. But they will happen time to time! In this part we'll get experience in resolving them once they arise. 1. Have BOTH Partner A and Partner B edit the below line. Each person should make it say something different. - ``` - EDIT THIS LINE - ``` + ``` + EDIT THIS LINE + ``` 1. Have BOTH Partner A and Partner B add, commit, and push the changes. You can refer to the above steps for a refresher on how to add/commit/push. One of the partners will get an error saying that their changes can't be pushed. This is OK and expected. Today we are practicing how to resolve this error. 1. Have the error partner pull the other partner's changes: - ``` - git pull - ``` + ``` + git pull + ``` 1. There will be an message about a merge conflict. This is expected! This is what we're practicing how to resolve. 1. Have the partner who got the error run git status. It should tell you that there is a merge conflict and you both have modified `README.md` - ``` - git status - ``` + ``` + git status + ``` 1. ONLY the error partner should open the README in VSCode. There should be both changes and extra text separating them. It will look something like this: - ![An image showing a merge conflict in VS Code](./images/conflict.PNG) + ![An image showing a merge conflict in VS Code](./images/conflict.PNG) 1. Resolve the merge conflict to include both of the changes and delete the extra lines. 1. Mark the conflicted file as resolved with git add. - ``` - git add README.md - ``` + ``` + git add README.md + ``` 1. Run git status again. The README should be in green. - ``` - git status - ``` + ``` + git status + ``` 1. Commit the confict resolution: - ``` - git commit -m "Resolved merge conflict" - ``` + ``` + git commit -m "Resolved merge conflict" + ``` 1. Push the changes to GitHub. - ``` - git push - ``` + ``` + git push + ``` 1. Have the other partner pull the changes and verify that both changes are there: - ``` - git pull - ``` + ``` + git pull + ``` 1. The code should be the same on both computers. Congrats on resolving your first merge conflict! ## Running the Project + 1. Both partners should compile the project. Make sure that you are in the root of the project's directory. - ``` - javac src/*.java - ``` + ``` + javac src/*.java + ``` 1. Both partners should try running the project: - ``` - java -cp src SayApp - ``` + ``` + java -cp src SayApp + ``` 1. Follow the prompts to give input and run the program. 1. Make sure it works on both computers. ## Updating the project + 1. Read through the code and understand what it's doing. Talk with your partner about it! Talk about any object-oriented practices you see occuring. Talk about what data structures are used. 1. Each partner should make a new class that implements the Animal interface. Each person should do this on their own computer! There is some ASCII art [provided below](#sample-ascii-art), but feel free to add your own if you prefer. If you copy from some source on the internet please make sure to add attribution in a comment. Note that you may need to [escape some characters](https://codegym.cc/groups/posts/escaping-characters-java) if you make your own art. 1. Always make sure to save and compile your files again before re-running the program. As you're working, follow good git practices of pulling, editing, adding, committing, and pushing. @@ -126,16 +136,17 @@ We will now artificially trigger a merge conflict. When we follow good git pract 1. Merge conflicts may arise! This is OK! Keep calm and resolve them as they come up. ## Submitting + 1. Have ONLY PARTNER A make a pull request against the original repository. 1. Have partner A give the URL of the pull request to partner B. 1. BOTH PARTNERS MUST SUBMIT THE URL OF THE PULL REQUEST TO CANVAS. You will both be submitting the same URL. ## Want more? + Try updating the program so that it can handle multiple lines of text. Or make any other change you find interesting! ## Sample ASCII art + [Dog](art/dog.txt) [Deer](art/deer.txt) - - From f89a1325624ae202306b02c7083c0fe43fd9a5b0 Mon Sep 17 00:00:00 2001 From: RMarx1456 Date: Thu, 3 Oct 2024 14:27:48 -0700 Subject: [PATCH 3/5] Conflict emulation --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff6ae68..cc02063 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # grcsay -Hello +Hello Doggy An exercise for collaborating with git / GitHub. Please read the directions CAREFULLY! I recommend focusing on the changes to the README before reading the Java code. ## Setting up git merging strategy From 3e173c560cfc6d67d9de7bbb35a4d6c5e7d200fa Mon Sep 17 00:00:00 2001 From: Zachary Springer Date: Thu, 3 Oct 2024 14:28:03 -0700 Subject: [PATCH 4/5] Said goodbye --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ff6ae68..121f0c3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # grcsay -Hello +Hello and Goodbye An exercise for collaborating with git / GitHub. Please read the directions CAREFULLY! I recommend focusing on the changes to the README before reading the Java code. ## Setting up git merging strategy From e26a9f868513f1aee79319fd9e6ceb1d39f7036e Mon Sep 17 00:00:00 2001 From: RMarx1456 Date: Thu, 3 Oct 2024 14:38:03 -0700 Subject: [PATCH 5/5] 3rd try --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cc02063..fec140f 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # grcsay -Hello Doggy +Hello Doggy Hello An exercise for collaborating with git / GitHub. Please read the directions CAREFULLY! I recommend focusing on the changes to the README before reading the Java code. ## Setting up git merging strategy