├── .github ├── dependabot.yml ├── files │ ├── _sidebar01.md │ ├── _sidebar02.md │ ├── issue01.md │ └── issue02.md ├── steps │ ├── -step.txt │ ├── 0-welcome.md │ ├── 1-resolve-duplicate-issues.md │ ├── 2-find-commit-in-history.md │ ├── 3-fix-broken-sidebar.md │ └── X-finish.md └── workflows │ ├── 0-welcome.yml │ ├── 1-resolve-duplicate-issues.yml │ ├── 2-find-commit-in-history.yml │ └── 3-fix-broken-sidebar.yml ├── .gitignore ├── LICENSE ├── README.md └── docs ├── .nojekyll ├── README.md ├── _sidebar.md ├── doc-references.md ├── git-tips.md ├── index.html ├── learning-resources.md └── past-work.md /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "monthly" 7 | -------------------------------------------------------------------------------- /.github/files/_sidebar01.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | - [Learning resources](learning-resources.md) 4 | - [Documentation references](doc-references_.md) 5 | - [Past work](past-work.md) 6 | -------------------------------------------------------------------------------- /.github/files/_sidebar02.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | - [Learning resources](learning-resources.md) 4 | - [Documentation references](doc-references__.md) 5 | - [Past work](past-work.md) 6 | -------------------------------------------------------------------------------- /.github/files/issue01.md: -------------------------------------------------------------------------------- 1 | # GIVEN: 2 | 3 | - User opens \_sidebar.md file 4 | 5 | # WHEN: 6 | 7 | - User navigates by clicking on [Documentation references] link 8 | 9 | # THEN (EXPECTED): 10 | 11 | - [Documentation references] page must be open successfully 12 | 13 | # OBSERVED: 14 | 15 | - File not found error OR GitHub reports HTTP 404 error (file not found) 16 | -------------------------------------------------------------------------------- /.github/files/issue02.md: -------------------------------------------------------------------------------- 1 | # GIVEN: 2 | 3 | - User opens \_sidebar.md file 4 | 5 | # WHEN: 6 | 7 | - User navigates by clicking on [Documentation references] link 8 | 9 | # THEN (EXPECTED): 10 | 11 | - [Documentation references] page must be open successfully 12 | 13 | # OBSERVED: 14 | 15 | - File not found error OR GitHub reports HTTP 404 error (file not found) 16 | -------------------------------------------------------------------------------- /.github/steps/-step.txt: -------------------------------------------------------------------------------- 1 | 0 2 | -------------------------------------------------------------------------------- /.github/steps/0-welcome.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.github/steps/1-resolve-duplicate-issues.md: -------------------------------------------------------------------------------- 1 | 8 | 9 | ## Step 1: Resolve duplicate issues 10 | 11 | _Welcome to the course :tada:_ 12 | 13 | GitHub has special capabilities to help reference other information on GitHub. For example, when you reference another issue or pull request by number, that number will be hyperlinked. At the same time, a cross-reference is created in the linked issue or pull request. This two-way reference helps people track the relationship of information across GitHub. 14 | 15 | ![a screenshot of an issue linking to a PR, and a PR with a cross-reference to the issue](https://user-images.githubusercontent.com/6351798/172456846-2daec570-08b0-4ffa-a7cb-41acc50b836e.png) 16 | 17 | With collaboration from multiple team members, sometimes issues can be duplicated. In the above example, the new issue `#8346` is a duplicate of a previous issue `#8249`. The cross-reference ability allows you to track these duplications and close issues when appropriate. 18 | 19 | ### Creating references 20 | 21 | When you link to another issue, a reference within GitHub is automatically created. In fact, you don't even need to include the full link. If you were to type `#5` within a comment, that would turn into a link to issue or pull request number 5. 22 | 23 | When you want to create a crosslink, start typing the title of an issue or pull request directly after you type the `#` symbol. GitHub will suggest issues or pull requests that will link to the right place. To learn even more, check out the [Autolinked References and URLs](https://docs.github.com/en/articles/autolinked-references-and-urls) article. 24 | 25 | ### :keyboard: Activity: Find and close the cross-linked issue 26 | 27 | 1. Navigate to the issue #1 (Welcome) 28 | 2. Type "Duplicate of #2" as a comment and close issue #1 29 | 3. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. 30 | -------------------------------------------------------------------------------- /.github/steps/2-find-commit-in-history.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | ## Step 2: Find a commit in history 8 | 9 | _Thanks for the duplicate note :wave:_ 10 | 11 | An important part of version control is the ability to look into the past. By using `git blame`, and finding the story behind a commit, we're able to do more than _blame_ people for code. We're able to see the story around why a commit was made. What is the associated pull request? Who approved the pull request? What tests were run on that commit before it was merged? 12 | 13 | The obvious reason to find things in history is to know about the history. With issues and pull requests, we see a more complete story about the history, not just the bare minimum. 14 | 15 | ### What's `git blame`? 16 | 17 | `git blame` is a Git functionality that shows what revision and author last modified each line of a file. Information like who made a commit, when, and even why can be found this way. If you aren't sure who introduced certain changes to a file, you can use `git blame` to find out. While `git blame` sounds rather accusatory, this can be used to understand the context around decisions. 18 | 19 | ### What's a Secure Hash Algorithm (SHA)? 20 | 21 | A SHA is a reference to a specific object. In this case, it's a reference to a commit. On GitHub, you can look at a specific commit to see the changes introduced, by whom, and if they were a part of a pull request. 22 | 23 | ### :keyboard: Activity: Find commit in history 24 | 25 | 1. Navigate to the Code tab of your repository 26 | - _Tip: you may have previously created your repository in a new tab_ 27 | 2. Click `docs` to navigate into the `/docs` directory 28 | 3. Click `_sidebar.md` to view the file 29 | 4. On the top of the file, click **Blame** to see the details of the most recent revision 30 | 5. Click the commit message, `add sidebar to documentation` to see the commit details 31 | 6. Copy the first seven characters of the SHA (the first 7 characters of the 40 character hexadecimal string listed after `commit`) 32 | 7. Comment on issue #2 by adding the SHA from step 6 as a comment text and click on "Comment" button 33 | 8. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. 34 | -------------------------------------------------------------------------------- /.github/steps/3-fix-broken-sidebar.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | ## Step 3: Fix a broken sidebar 8 | 9 | _Great job finding that commit :heart:_ 10 | 11 | Thanks for finding that commit! We now know that the sidebar was indeed added, and it was done in that commit. Let's see if we can dig a little deeper to find out if any planning or conversation, using comments, occurred around this change. 12 | 13 | As we've already seen, conversations in issues and pull requests can reference other work, but the amount of context goes much further than crosslinks. Remember, Git is version control! For example, the commit that you found in the last step is connected with much more information such as: 14 | 15 | - Who made the commit. 16 | - What other changes were included. 17 | - When the commit was made. 18 | - Which pull request the commit was a part of. 19 | 20 | The pull request is important because it goes beyond knowing when a commit happened. You can know _why_ a commit happened. Finding history is not about _blaming_ anyone, but about seeing the bigger picture. Why were decisions made? Who was involved? What were the build outputs and test results for each commit? Who requested changes, and who approved them? 21 | 22 | ### Finding a pull request from a commit 23 | 24 | When you're looking at a commit on GitHub, you can see a lot of information. From this view, you can also find a link to the pull request in which the commit was created. We'll use this in the next step. 25 | 26 | ![screenshot of a view of a commit on GitHub, highlighting the link to the pull request](https://user-images.githubusercontent.com/16547949/67341250-3edbb480-f4fd-11e9-805a-6bce5a8ba2d1.png) 27 | 28 | ### :keyboard: Activity: Fix a broken sidebar 29 | 30 | 1. In the main branch [Edit the `docs/_sidebar.md` file](/docs/_sidebar.md). 31 | 2. Correct the spelling of the reference `(doc-references__.md)` on line 4 by changing it into `(doc-references.md)`. 32 | 3. Select or create a new branch `fix-sidebar` for this commit and start a pull request. 33 | 4. Make sure that **main** is selected for **base:** and **fix-sidebar** for **compare:**. 34 | 5. Using the **Assignees** section on the right side, assign yourself to the pull request. 35 | 6. In the PR comment add 'Closes #2' and autolink issue #2. 36 | 7. Click **Create pull request** and wait about 20 seconds. 37 | 8. Merge this pull request. 38 | 9. Delete the branch 'fix-sidebar'. 39 | 10. Wait about 20 seconds then refresh this page (the one you're following instructions from). [GitHub Actions](https://docs.github.com/en/actions) will automatically update to the next step. 40 | -------------------------------------------------------------------------------- /.github/steps/X-finish.md: -------------------------------------------------------------------------------- 1 | 5 | 6 | ## Finish 7 | 8 | _Congratulations friend, you've completed this course! :tada:_ 9 | 10 | celebrate 11 | 12 | In this course, you've learned a lot about finding and sharing information. Within a GitHub repository, you can find history about what changes were made, and more importantly, _why_ changes were made. 13 | 14 | ### What's next? 15 | 16 | You can enable GitHub Pages and see `docs/index.html` as a website! 17 | 18 | 1. Replace `USERNAME` with your GitHub username and `REPONAME` with your GitHub repository name in `docs/index.html`. 19 | 1. Under your repository name at the upper right, click :gear: **Settings**. 20 | 1. Then on the lower left, click **Pages**. 21 | 1. In the **GitHub Pages** section, select `main` in the **Select branch** drop-down menu and `/docs` in the **Select folder** drop-down menu. 22 | 1. Click the **Save** button. 23 | 1. Wait about 30 seconds then refresh the page. When you see "Your site is published at ...," you can click on the link to see your published site. 24 | 25 | Check out these resources to learn more or get involved: 26 | 27 | - Are you a student? Check out the [Student Developer Pack](https://education.github.com/pack). 28 | - We'd love to hear what you thought of this course in our [discussion board](https://github.com/orgs/skills/discussions/categories/connect-the-dots). 29 | - [Take another GitHub Skills course](https://github.com/skills). 30 | - [Read the GitHub Getting Started docs](https://docs.github.com/en/get-started). 31 | - To find projects to contribute to, check out [GitHub Explore](https://github.com/explore). 32 | -------------------------------------------------------------------------------- /.github/workflows/0-welcome.yml: -------------------------------------------------------------------------------- 1 | name: Step 0, Welcome 2 | 3 | # This step listens for the learner pushing a commit to `main`. 4 | # This workflow updates from step 0 to step 1. 5 | 6 | # This will run every time we push a commit to `main`. 7 | # Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows 8 | on: 9 | workflow_dispatch: 10 | push: 11 | branches: 12 | - main 13 | 14 | permissions: 15 | contents: write 16 | pull-requests: write 17 | issues: write 18 | 19 | jobs: 20 | # Get the current step to only run the main job when the learner is on the same step. 21 | get_current_step: 22 | name: Check current step number 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v4 27 | - id: get_step 28 | run: | 29 | echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT 30 | outputs: 31 | current_step: ${{ steps.get_step.outputs.current_step }} 32 | 33 | on_start: 34 | name: On start 35 | needs: get_current_step 36 | 37 | # We will only run this action when: 38 | # 1. This repository isn't the template repository. 39 | # 2. The step is currently 0. 40 | # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts 41 | # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions 42 | if: >- 43 | ${{ !github.event.repository.is_template 44 | && needs.get_current_step.outputs.current_step == 0 }} 45 | 46 | # We'll run Ubuntu for performance instead of Mac or Windows. 47 | runs-on: ubuntu-latest 48 | 49 | steps: 50 | # We'll need to check out the repository so that we can edit the README. 51 | - name: Checkout 52 | uses: actions/checkout@v4 53 | with: 54 | fetch-depth: 0 # Let's get all the branches. 55 | 56 | # This is required to establish related issues 57 | # after being created from the template repository. 58 | - name: Prepare issues 59 | run: | 60 | echo "Make sure we are on step 0" 61 | if [ "$(cat .github/steps/-step.txt)" != 0 ] 62 | then 63 | echo "Current step is not 0" 64 | exit 0 65 | fi 66 | echo "Create issue #1 from file" 67 | gh issue create --title "Welcome" -F .github/files/issue01.md 68 | echo "Create issue #2 from file" 69 | gh issue create --title "Fix the sidebar" -F .github/files/issue02.md 70 | env: 71 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 72 | 73 | # This is required to create a relevant history for docs/_sidebar.md 74 | # after being created from the template repository. 75 | - name: Prepare files history 76 | run: | 77 | echo "Make sure we are on step 0" 78 | if [ "$(cat .github/steps/-step.txt)" != 0 ] 79 | then 80 | echo "Current step is not 0" 81 | exit 0 82 | fi 83 | git config user.name github-actions[bot] 84 | git config user.email github-actions[bot]@users.noreply.github.com 85 | git checkout main 86 | echo "Update _sidebar.md for the 1st time" 87 | cp -f .github/files/_sidebar01.md docs/_sidebar.md 88 | git add docs/_sidebar.md 89 | git commit -m "updated _sidebar.md" 90 | git push 91 | echo "update _sidebar.md for the 2nd time" 92 | cp -f .github/files/_sidebar02.md docs/_sidebar.md 93 | git add docs/_sidebar.md 94 | git commit -m "add sidebar to documentation" 95 | git push 96 | echo "preserve the commit shaw" 97 | git log --all --oneline | grep "add sidebar to documentation" | cut -c 1-7 >> .github/files/SIDEBARCOMMIT 98 | git add .github/files/SIDEBARCOMMIT 99 | git commit -m "created SIDEBARCOMMIT" 100 | git push 101 | env: 102 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 103 | 104 | # Update README from step 0 to step 1. 105 | - name: Update to step 1 106 | uses: skills/action-update-step@v2 107 | with: 108 | token: ${{ secrets.GITHUB_TOKEN }} 109 | from_step: 0 110 | to_step: 1 111 | -------------------------------------------------------------------------------- /.github/workflows/1-resolve-duplicate-issues.yml: -------------------------------------------------------------------------------- 1 | name: Step 1, Resolve duplicate issues 2 | 3 | # This step listens for the learner creating or editing an issue comment. 4 | # This workflow updates from step 1 to step 2. 5 | 6 | # This will run every time we create or edit an issue comment. 7 | # Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows 8 | 9 | on: 10 | workflow_dispatch: 11 | issue_comment: 12 | types: [created, edited] 13 | 14 | permissions: 15 | # Need `contents: read` to checkout the repository. 16 | # Need `contents: write` to update the step metadata. 17 | contents: write 18 | 19 | jobs: 20 | # Get the current step to only run the main job when the learner is on the same step. 21 | get_current_step: 22 | name: Check current step number 23 | runs-on: ubuntu-latest 24 | steps: 25 | - name: Checkout 26 | uses: actions/checkout@v4 27 | - id: get_step 28 | run: | 29 | echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT 30 | outputs: 31 | current_step: ${{ steps.get_step.outputs.current_step }} 32 | 33 | on_duplicate_issue_closed: 34 | name: Check if duplicate issue is marked as duplicate 35 | needs: get_current_step 36 | 37 | # We will only run this action when: 38 | # 1. This repository isn't the template repository. 39 | # 2. The step is currently 1. 40 | # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts 41 | # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions 42 | if: >- 43 | ${{ !github.event.repository.is_template 44 | && needs.get_current_step.outputs.current_step == 1 }} 45 | 46 | # We'll run Ubuntu for performance instead of Mac or Windows. 47 | runs-on: ubuntu-latest 48 | 49 | steps: 50 | # We'll need to check out the repository so that we can edit the README. 51 | - name: Checkout 52 | uses: actions/checkout@v4 53 | with: 54 | fetch-depth: 0 # Let's get all the branches. 55 | 56 | - name: Dump GitHub comment context 57 | id: github_comment_step 58 | env: 59 | COMMENT_CONTEXT: ${{ toJSON(github.event.comment) }} 60 | run: echo "$COMMENT_CONTEXT" 61 | 62 | - name: Dump GitHub issue context 63 | id: github_issue_step 64 | env: 65 | ISSUE_CONTEXT: ${{ toJSON(github.event.issue) }} 66 | run: echo "$ISSUE_CONTEXT" 67 | 68 | - name: Check if commented issue is closed and marked as duplicate 69 | if: ${{ contains(github.event.comment.body, 'Duplicate of') && (github.event.issue.state == 'closed')}} 70 | run: echo 'Duplicate issue closed' 71 | 72 | # Update README from step 1 to step 2. 73 | - name: Update to step 2 74 | uses: skills/action-update-step@v2 75 | with: 76 | token: ${{ secrets.GITHUB_TOKEN }} 77 | from_step: 1 78 | to_step: 2 79 | -------------------------------------------------------------------------------- /.github/workflows/2-find-commit-in-history.yml: -------------------------------------------------------------------------------- 1 | name: Step 2, Find a commit in history 2 | 3 | # This step listens for the learner creating or editing an issue comment. 4 | # This workflow updates from step 2 to step 3. 5 | 6 | # This will run every time we create or edit an issue comment. 7 | # Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows 8 | on: 9 | workflow_dispatch: 10 | issue_comment: 11 | types: [created, edited] 12 | 13 | permissions: 14 | # Need `contents: read` to checkout the repository. 15 | # Need `contents: write` to update the step metadata. 16 | contents: write 17 | 18 | jobs: 19 | # Get the current step to only run the main job when the learner is on the same step. 20 | get_current_step: 21 | name: Check current step number 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v4 26 | - id: get_step 27 | run: | 28 | echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT 29 | - id: get_commit_id 30 | run: | 31 | echo "commit_id=$(cat ./.github/files/SIDEBARCOMMIT)" >> $GITHUB_OUTPUT 32 | outputs: 33 | current_step: ${{ steps.get_step.outputs.current_step }} 34 | commit_id: ${{ steps.get_commit_id.outputs.commit_id }} 35 | 36 | on_fix_the_sidebar_issue_comment: 37 | name: Check if the issue comment is referencing the correct commit ID 38 | needs: get_current_step 39 | 40 | # We will only run this action when: 41 | # 1. This repository isn't the template repository. 42 | # 2. The step is currently 2. 43 | # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts 44 | # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions 45 | if: >- 46 | ${{ !github.event.repository.is_template 47 | && needs.get_current_step.outputs.current_step == 2 }} 48 | 49 | # We'll run Ubuntu for performance instead of Mac or Windows. 50 | runs-on: ubuntu-latest 51 | 52 | steps: 53 | # We'll need to check out the repository so that we can edit the README. 54 | - name: Checkout 55 | uses: actions/checkout@v4 56 | with: 57 | fetch-depth: 0 # Let's get all the branches. 58 | 59 | - name: Dump GitHub comment context 60 | id: github_comment_step 61 | env: 62 | COMMENT_CONTEXT: ${{ toJSON(github.event.comment) }} 63 | run: echo "$COMMENT_CONTEXT" 64 | 65 | - name: Dump GitHub issue context 66 | id: github_issue_step 67 | env: 68 | ISSUE_CONTEXT: ${{ toJSON(github.event.issue) }} 69 | run: echo "$ISSUE_CONTEXT" 70 | 71 | - name: Check if the issue comment is referencing the required commit ID 72 | if: contains(github.event.comment.body, needs.get_current_step.outputs.commit_id) 73 | run: echo 'Found the reference to required commit in the comment' 74 | 75 | # Update README from step 2 to step 3. 76 | - name: Update to step 3 77 | uses: skills/action-update-step@v2 78 | with: 79 | token: ${{ secrets.GITHUB_TOKEN }} 80 | from_step: 2 81 | to_step: 3 82 | -------------------------------------------------------------------------------- /.github/workflows/3-fix-broken-sidebar.yml: -------------------------------------------------------------------------------- 1 | name: Step 3, Fix a broken sidebar 2 | 3 | # This step listens for the learner opening, editing, or reopening a pull request. 4 | # This workflow updates from step 3 to step X. 5 | 6 | # This will run every time we open, edit, or reopen the pull request. 7 | # Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows 8 | on: 9 | workflow_dispatch: 10 | pull_request: 11 | types: [opened, edited, reopened] 12 | 13 | permissions: 14 | # Need `contents: read` to checkout the repository. 15 | # Need `contents: write` to update the step metadata. 16 | contents: write 17 | 18 | jobs: 19 | # Get the current step to only run the main job when the learner is on the same step. 20 | get_current_step: 21 | name: Check current step number 22 | runs-on: ubuntu-latest 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v4 26 | - id: get_step 27 | run: | 28 | echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT 29 | outputs: 30 | current_step: ${{ steps.get_step.outputs.current_step }} 31 | 32 | on_fix_the_sidebar_pr_body: 33 | name: Check if the PR body is containing the correct closing message 34 | needs: get_current_step 35 | 36 | # We will only run this action when: 37 | # 1. This repository isn't the template repository. 38 | # 2. The step is currently 3. 39 | # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts 40 | # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions 41 | if: >- 42 | ${{ !github.event.repository.is_template 43 | && needs.get_current_step.outputs.current_step == 3 }} 44 | 45 | # We'll run Ubuntu for performance instead of Mac or Windows. 46 | runs-on: ubuntu-latest 47 | 48 | steps: 49 | # We'll need to check out the repository so that we can edit the README. 50 | - name: Checkout 51 | uses: actions/checkout@v4 52 | with: 53 | fetch-depth: 0 # Let's get all the branches. 54 | 55 | - name: Dump GitHub pull request context 56 | id: github_pull_request_step 57 | run: echo '${{ toJSON(github.event.pull_request) }}' 58 | 59 | - name: Check if the PR body is containing the required closing message 60 | if: contains(github.event.pull_request.body, 'Closes') 61 | run: echo "Found _Closes_ message with autolinked issue in the body of PR $NUMBER" 62 | env: 63 | NUMBER: ${{ github.event.pull_request.number }} 64 | 65 | # Update README from step 3 to step X. 66 | - name: Update to step X 67 | uses: skills/action-update-step@v2 68 | with: 69 | token: ${{ secrets.GITHUB_TOKEN }} 70 | from_step: 3 71 | to_step: X 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled source # 2 | ################### 3 | *.com 4 | *.class 5 | *.dll 6 | *.exe 7 | *.o 8 | *.so 9 | 10 | # Packages # 11 | ############ 12 | # it's better to unpack these files and commit the raw source 13 | # git has its own built in compression methods 14 | *.7z 15 | *.dmg 16 | *.gz 17 | *.iso 18 | *.jar 19 | *.rar 20 | *.tar 21 | *.zip 22 | 23 | # Logs and databases # 24 | ###################### 25 | *.log 26 | *.sql 27 | *.sqlite 28 | 29 | # OS generated files # 30 | ###################### 31 | .DS_Store 32 | .DS_Store? 33 | ._* 34 | .Spotlight-V100 35 | .Trashes 36 | ehthumbs.db 37 | Thumbs.db 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) GitHub, Inc. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | 3 | 9 | 10 | # Connect the dots in a GitHub repository 11 | 12 | _Useful tips when navigating through your repository._ 13 | 14 |
15 | 16 | 21 | 22 | ## Welcome 23 | 24 | Have you ever worked in a repository with a lot of history? Perhaps you've had to track down related issues and pull requests in the past, or you've had to find who committed a particular change. If you've ever found yourself in any of these situations, you'll know how important it is to navigate your workspace. 25 | 26 | - **Who is this for**: Developers, GitHub users, users new to Git, students, managers, and teams. 27 | - **What you'll learn**: 28 | - Find relevant issues and pull requests. 29 | - Search history to find context. 30 | - Make connections within GitHub to help others find things. 31 | - **What you'll build**: Repository with existing commits, duplicated issues, and a content defect to be fixed. 32 | - **Prerequisites**: Before you take this course, you may want to go through the [GitHub Quickstart](https://docs.github.com/en/get-started/quickstart) introduction on GitHub Docs and [Introduction to GitHub](https://github.com/skills/introduction-to-github) course on GitHub Skills. 33 | - **How long**: This course takes less than 15 min to complete. 34 | 35 | In this course, you will: 36 | 37 | 1. Resolve a duplicate issue. 38 | 2. Find a commit in history. 39 | 3. Fix a broken sidebar. 40 | 41 | ### How to start this course 42 | 43 | 53 | 54 | [![start-course](https://user-images.githubusercontent.com/1221423/235727646-4a590299-ffe5-480d-8cd5-8194ea184546.svg)](https://github.com/new?template_owner=skills&template_name=connect-the-dots&owner=%40me&name=skills-connect-the-dots&description=My+clone+repository&visibility=public) 55 | 56 | 1. Right-click **Start course** and open the link in a new tab. 57 | 2. In the new tab, most of the prompts will automatically fill in for you. 58 | - For owner, choose your personal account or an organization to host the repository. 59 | - We recommend creating a public repository, as private repositories will [use Actions minutes](https://docs.github.com/en/billing/managing-billing-for-github-actions/about-billing-for-github-actions). 60 | - Scroll down and click the **Create repository** button at the bottom of the form. 61 | 3. After your new repository is created, wait about 20 seconds, then refresh the page. Follow the step-by-step instructions in the new repository's README. 62 | 63 | 77 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skills/connect-the-dots/170b5a20580b610161024b26850d3f756ee2f4d7/docs/.nojekyll -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/skills/connect-the-dots/170b5a20580b610161024b26850d3f756ee2f4d7/docs/README.md -------------------------------------------------------------------------------- /docs/_sidebar.md: -------------------------------------------------------------------------------- 1 | # Resources 2 | 3 | - [Learning resources](learning-resources.md) 4 | - [Documentation references](doc-references.md) 5 | - [Past work](past-work.md) 6 | -------------------------------------------------------------------------------- /docs/doc-references.md: -------------------------------------------------------------------------------- 1 | # Documentation References 2 | 3 | _List handy documentation references, like https://docsify.js.org._ 4 | -------------------------------------------------------------------------------- /docs/git-tips.md: -------------------------------------------------------------------------------- 1 | # GIT tips 2 | 3 | # Fetch a file from another branch to the current one 4 | 5 | git checkout branch_name -- filename 6 | 7 | # Unstage all changes but leave files in the working directory untouched 8 | 9 | git reset HEAD 10 | 11 | # Unstage a file 12 | 13 | git reset HEAD 14 | 15 | # Go back to last commit and remove all changes from working directory 16 | 17 | git reset HEAD --hard 18 | 19 | # Delete untracked files 20 | 21 | git clean -f 22 | 23 | # Compare two branches 24 | 25 | git diff develop..master 26 | 27 | # Compare two commits 28 | 29 | git diff .. 30 | 31 | ## Unstage file 32 | 33 | ```bash 34 | git reset filename 35 | ``` 36 | 37 | ## Unstage deleted file 38 | 39 | ```bash 40 | git checkout HEAD filename 41 | ``` 42 | 43 | ## Undo commit 44 | 45 | ```bash 46 | git reset --soft HEAD\^ 47 | ``` 48 | 49 | ## Checkout remote branch 50 | 51 | ```bash 52 | git fetch origin 53 | git checkout develop 54 | ``` 55 | 56 | ## Go back to previous branch 57 | 58 | ```bash 59 | git checkout - 60 | ``` 61 | 62 | ## Create empty master branch 63 | 64 | ```bash 65 | git branch -D master 66 | git checkout --orphan master 67 | ``` 68 | 69 | ## Tag the release 70 | 71 | ```bash 72 | # optional: tag important things, such as releases 73 | git tag 1.0.0-RC1 74 | ``` 75 | 76 | ## Delete local tag 77 | 78 | ```bash 79 | git tag -d v0.2.0 80 | ``` 81 | 82 | ## Delete remote tag 83 | 84 | ```bash 85 | git push origin :refs/tags/v0.2.0 86 | ``` 87 | 88 | ## Amend last commit 89 | 90 | If you want to change the message of the latest commit do 91 | 92 | ```bash 93 | git commit --amend -m "New commit message" 94 | ``` 95 | 96 | ## Revert specific file to previous version 97 | 98 | If you want to revert a specific file to its previous version do 99 | 100 | ```bash 101 | git checkout -- filename 102 | ``` 103 | 104 | ## Undo all changes in branch 105 | 106 | If you want to reset all non-committed changes do 107 | 108 | ```bash 109 | git reset --hard 110 | ``` 111 | 112 | ## Restore a file deleted in a previous commit 113 | 114 | If you want to restore a file deleted in a previous commit do 115 | 116 | ```bash 117 | git rev-list -n 1 HEAD -- 118 | git checkout ^ -- 119 | ``` 120 | 121 | ## Remove a file from a commit that has not been pushed 122 | 123 | If you want to remove a specific file from a commit that has not been pushed do 124 | 125 | ```bash 126 | git reset HEAD filename 127 | ``` 128 | 129 | You can do it without the --, but if the filename looks like a branch or tag (or other revision identifier), it may get confused, so using -- is best. 130 | 131 | ## Checkout specific version of file 132 | 133 | You can also check out a particular version of a file 134 | 135 | ```bash 136 | git checkout v1.2.3 -- filename # tag v1.2.3 137 | git checkout stable -- filename # stable branch 138 | git checkout origin/master -- filename # upstream master 139 | git checkout HEAD -- filename # the version from the most recent commit 140 | git checkout HEAD^ -- filename # the version before the most recent commit 141 | ``` 142 | 143 | ## Remove a commit that has not been pushed 144 | 145 | ```bash 146 | git reset --hard HEAD^ 147 | ``` 148 | 149 | to reset to the previous commit before the current head; that way you don't have to be copying around commit IDs. 150 | 151 | ## Revert a commit 152 | 153 | Identify the hash of the commit, using `git log`, then use `git revert ` to create a new commit that removes these changes. In a way, `git revert` is the converse of `git cherry-pick` -- the latter applies the patch to a branch that's missing it, the former removes it from a branch that has it. 154 | 155 | ## Create a patch 156 | 157 | ```bash 158 | git commit ... 159 | git checkout 160 | git format-patch --stdout > fix_empty_poster.patch 161 | git apply --stat fix_empty_poster.patch 162 | git apply --check fix_empty_poster.patch 163 | git am --signoff < fix_empty_poster.patch 164 | ``` 165 | 166 | or 167 | 168 | ```bash 169 | git diff > fix_empty_poster.patch 170 | git apply fix_empty_poster.patch 171 | ``` 172 | 173 | ## Sync a fork 174 | 175 | Add remote repository `upstream`. 176 | 177 | ```bash 178 | git remote add upstream https://github.com/trntv/yii2-starter-kit.git 179 | ``` 180 | 181 | Fetch latest commit from it 182 | 183 | ```bash 184 | git fetch upstream 185 | ``` 186 | 187 | Merge these commits to your repository 188 | 189 | ```bash 190 | git checkout master 191 | git merge upstream/master 192 | ``` 193 | 194 | **IMPORTANT: there might be a conflicts between `upstream` and your code. You should resolve merging conflicts on your own** 195 | 196 | ## Prune remote branches 197 | 198 | ```bash 199 | git fetch --prune && git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d 200 | ``` 201 | 202 | ## Submodules 203 | 204 | If you want to use someone else's repo as a Git Submodule on GitHub do 205 | 206 | ```bash 207 | git submodule add git://github.com/username/repo.git destination/folder 208 | git submodule init 209 | git submodule update 210 | ``` 211 | 212 | from the root of your project. 213 | 214 | ## Stash 215 | 216 | ```bash 217 | git stash save 218 | git stash save --include-untracked (-u) 219 | git stash pop (git stash apply && git stash drop) 220 | git stash apply (to re-use same stash later) 221 | git stash list 222 | git stash show 223 | git stash apply 224 | git stash branch testchanges 225 | ``` 226 | 227 | ## Renaming branches 228 | 229 | If you want to rename a branch while pointed to any branch, do : 230 | 231 | ``` 232 | git branch -m 233 | ``` 234 | 235 | If you want to rename the current branch, you can do: 236 | 237 | ``` 238 | git branch -m 239 | ``` 240 | 241 | ## git-extras 242 | 243 | ```bash 244 | git setup (from git-extras) 245 | git ignore .DS_Store 246 | git summary 247 | git effort --above 10 248 | git undo 249 | ``` 250 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /docs/learning-resources.md: -------------------------------------------------------------------------------- 1 | # Learning resources 2 | 3 | _List your favorite learning resources here._ 4 | -------------------------------------------------------------------------------- /docs/past-work.md: -------------------------------------------------------------------------------- 1 | # Past work 2 | 3 | _Include references to your own completed Learning Labs or other work_. 4 | --------------------------------------------------------------------------------