{"id":24508508,"url":"https://github.com/adygcode/my-first-pr","last_synced_at":"2026-01-02T22:16:04.201Z","repository":{"id":253733032,"uuid":"844353209","full_name":"AdyGCode/my-first-pr","owner":"AdyGCode","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-19T05:43:33.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-22T00:16:26.825Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AdyGCode.png","metadata":{"files":{"readme":"ReadMe.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-19T04:39:47.000Z","updated_at":"2024-08-19T05:43:36.000Z","dependencies_parsed_at":"2024-08-19T12:17:43.402Z","dependency_job_id":null,"html_url":"https://github.com/AdyGCode/my-first-pr","commit_stats":null,"previous_names":["adygcode/my-first-pr"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdyGCode%2Fmy-first-pr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdyGCode%2Fmy-first-pr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdyGCode%2Fmy-first-pr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AdyGCode%2Fmy-first-pr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AdyGCode","download_url":"https://codeload.github.com/AdyGCode/my-first-pr/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243707946,"owners_count":20334734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-22T00:16:42.000Z","updated_at":"2026-01-02T22:16:04.174Z","avatar_url":"https://github.com/AdyGCode.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Intro to PRs\n\n![Illustrative image of people working together](colab.png)\n\nYou can use the following guide to learn how and why to create a pull request.\n\n## What is a pull request?\n\nA pull request is a way to suggest changes to a repository. When you create a pull request, you propose your changes and request that someone review and pull in your contribution and merge them into their branch. Pull requests show differences between the content from both branches and the changes are visible in the repository.\n\n\u003c!-- TODO: Add information on PRs and forks. --\u003e\n\u003c!-- DO NOT do this until told in the steps below --\u003e\n\n\n## Set up your environment\n\n### Create a local copy of the repository\n\nCopy the following file to a new Git repo.\n\n```bash\ncd ~/source/repos\ngit init my-first-pr\ncd my-first-pr\ncp ~/Downloads/README.md .\n```\n\n\u003e **Important Note:**\n\u003e If you get an error because the file is missing, then do the following:\n\u003e \n\u003e ```shell\n\u003e ls -l ~/Downloads/README*.md \n\u003e ```\n\u003e \n\u003e This will show if you have more than one ReadMe  file. For example:\n\u003e\n\u003e ```text\n\u003e -rw-r--r-- 1 AD+5001775 536871425 5679 Aug 19 \u003e 12:55 '/c/Users/5001775/Downloads/README(1)(1).md'\n\u003e ```\n\u003e In this situation we need to copy the file an \u003e rename it in one go using:\n\u003e ```shell\n\u003e cp ~/Downloads/README(1)(1).md ReadMe.md\n\u003e ```\n\n\n**IMPORTANT:** Please ensure you continue working on the file copy and not the original.\n\nTo do this, close this file and then at the command line type the following:\n```shell\ncode .\n```\n\nor use the file explorer to locate and open the repository's copy of the ReadMe.md file.\n\n\n### Create an empty repository on GitHub\n\n1. Go to [GitHub](https://github.com) and sign in.\n2. In the upper-right corner of any page, select `➕`, and then select `New repository`.\n3. Name your repository `my-first-pr`.\n   **IMPORTANT:** Do not initialize the repository with a `README`, `.gitignore`, or license.\n4. Note the name of your repository `URL` here: **\u003cURL\u003e**\n   You'll need this information later.\n\n### Add the remote repository\n\n1. In the terminal, add the URL of the repository you created on GitHub as the remote repository.\n\n```bash\ngit remote add origin \u003cURL\u003e\n```\n\n2. Check that the remote repository was added.\n\n```bash\ngit remote -v\n```\n\n3. Consider why it does not provide a URL for pull, only `push` and `fetch`?\n\n---\n\n4. Push the local repository to the remote repository.\n\n   ```bash\n   git push -u origin main\n   ```\n\n\u003e **Important** \n\u003e \n\u003e You will get an error if you have not added the updated `ReadMe.md` file and then committed it...\n\u003e So if that is the case make sure you do a `git add ReadMe.md` and then commit it using `git commit -m \"init: start of exercise\"`. \n\u003e\n\u003e Once you have done this, use the `git push -u origin main` again.\n\n\n5. Refresh the GitHub page for your repository. You should see this `README.md` file.\n\n### Why are pull requests called \"Pull Requests\"? (wrong answer)\n\nPull requests are so named basically because you are asking to _pull_ changes from a remote to your local repository. And that's because you have to ask permission to copy changes out of the repository, even if you have read access to that repository.\n\n\u003c!--TODO: This answer is SO wrong, I think we need to fix it! --\u003e\n\u003c!-- DO NOT do this until told in the steps below --\u003e\n\n### Create a local branch\n\nYou read the definition above, and you can't believe they got it this wrong. The name `Pull Request` can be misleading, but come on!\n\nYou decide to fix the definition above, but BEFORE you do that, you need to create a new branch to work on.\n\n1. Create a new branch and switch to it.\n\n```bash\n# Older style:\ngit checkout -b fix/pr-definition\n# Or, newer style:\ngit switch -c fix/pr-definition\n```\n\n2. Edit this file and address the two TODO items in two separate commits.\n\n```bash\ngit commit -am \"Add forks to the PR definition\"\ngit commit -am \"Give correct reason to why PRs are named that\"\n```\n\n3. Check on GitHub whether the branch exists there or not. Does it? Why or why not?\n4. You may think it is because you haven't pushed to the branch yet, so go ahead and try to push the branch to the remote repository.\n\n```bash\ngit push\n```\n\nYou probably got a similar error to this:\n\n```text\nfatal: The current branch fix/pr-definition has no upstream branch\n```\n\n5. What does this error mean? Why did it happen? Git explains how to fix it by running a command that will:\n   \n   1. Create a new branch on the remote repository with the same name as the local branch (if the remote branch doesn't already exist).\n   2. Set the local branch to track the remote branch.\n   3. Push the local branch to the remote repository.\n   \n7. Run the command that Git suggests to fix the error. There is also a shorthand for this command:\n\n```bash\ngit push -u origin fix/pr-definition\n```\n\n7. Refresh the GitHub page for your repository. You should see the new branch there. GitHub will also suggest that you create a pull request. Do you see that?\n\n### Create a pull request\n\n1. Select `Compare \u0026 pull request`.\n2. Note that the base repository and compare branch are correct.\n3. Add a title and description for your pull request. Here is an example of a high-quality pull request description:\n\n   ```markdown\n   Title: Fix PR definition\n   Description: This pull request fixes the definition of a pull request. It adds information about forks and corrects why pull requests are called \"pull requests\".\n   ```\n\n4. Select `Create pull request`.\n\n### Review and merge a pull request\n\n1. Go to the `Pull requests` tab on the repository page.\n2. Select the pull request you created.\n3. Review the changes in the pull request. You can see the commits that were added to the branch. You can also view the changes in the `Files changed` tab.\n4. Add a comment to the pull request. Please feel free to ask for more information, suggest changes, or approve the pull request.\n5. Select `Merge pull request` to merge the changes into the `main` branch.\n\nNotice that GitHub suggests that you delete the branch after merging. This is a good practice because it keeps your repository clean and easy to navigate. It is part of a Git workflow called `GitHub flow`.\n\n\n## Add the Picture\n\nFollow the concepts you pacticed above, using the steps below with a new branch `fix/add-image`.\n\nIn this exercise you will:\n\n- create a new branch `fix/add-image` and switch to the new branch\n- copy the colag.png file to the repository folder using `cp colab.png ./`\n- add the image to version control using `git add` \n- commit the change to the repository using `git commit -m \"fix: Add image for ReadMe.md banner\"`\n- push the changes the remote `fix/add-image` branch\n- create a pull request to merge the fix into the main branch\n- merge the pull request with a comment of `image accepted for ReadMe`\n- check the ReadMe now has the iamge visible\n- Once all done, delete the `fix/add-image` branch as it is no longer needed.\n\n\n\n\n### Optional: Fork someone else's repository and create a pull request\n\nIf you are doing this in class, you can fork the repository of the person sitting next to you. If you are doing this on your own, you can fork a friend's or colleague's repository.\n\nWhen you fork their repo, examine their definition and try to improve on it, then create a pull request to suggest your changes on **their** repository.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadygcode%2Fmy-first-pr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadygcode%2Fmy-first-pr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadygcode%2Fmy-first-pr/lists"}