diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..8ac6b8c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,6 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "monthly" diff --git a/.github/files/_sidebar01.md b/.github/files/_sidebar01.md new file mode 100644 index 0000000..c75b4df --- /dev/null +++ b/.github/files/_sidebar01.md @@ -0,0 +1,5 @@ +# Resources + +- [Learning resources](learning-resources.md) +- [Documentation references](doc-references_.md) +- [Past work](past-work.md) diff --git a/.github/files/_sidebar02.md b/.github/files/_sidebar02.md new file mode 100644 index 0000000..258c20e --- /dev/null +++ b/.github/files/_sidebar02.md @@ -0,0 +1,5 @@ +# Resources + +- [Learning resources](learning-resources.md) +- [Documentation references](doc-references__.md) +- [Past work](past-work.md) diff --git a/.github/files/issue01.md b/.github/files/issue01.md new file mode 100644 index 0000000..ef93fe8 --- /dev/null +++ b/.github/files/issue01.md @@ -0,0 +1,15 @@ +# GIVEN: + +- User opens \_sidebar.md file + +# WHEN: + +- User navigates by clicking on [Documentation references] link + +# THEN (EXPECTED): + +- [Documentation references] page must be open successfully + +# OBSERVED: + +- File not found error OR GitHub reports HTTP 404 error (file not found) diff --git a/.github/files/issue02.md b/.github/files/issue02.md new file mode 100644 index 0000000..ef93fe8 --- /dev/null +++ b/.github/files/issue02.md @@ -0,0 +1,15 @@ +# GIVEN: + +- User opens \_sidebar.md file + +# WHEN: + +- User navigates by clicking on [Documentation references] link + +# THEN (EXPECTED): + +- [Documentation references] page must be open successfully + +# OBSERVED: + +- File not found error OR GitHub reports HTTP 404 error (file not found) diff --git a/.github/steps/-step.txt b/.github/steps/-step.txt new file mode 100644 index 0000000..573541a --- /dev/null +++ b/.github/steps/-step.txt @@ -0,0 +1 @@ +0 diff --git a/.github/steps/0-welcome.md b/.github/steps/0-welcome.md new file mode 100644 index 0000000..9ff13a5 --- /dev/null +++ b/.github/steps/0-welcome.md @@ -0,0 +1 @@ + diff --git a/.github/steps/1-resolve-duplicate-issues.md b/.github/steps/1-resolve-duplicate-issues.md new file mode 100644 index 0000000..48457e4 --- /dev/null +++ b/.github/steps/1-resolve-duplicate-issues.md @@ -0,0 +1,29 @@ + + +## Step 1: Resolve duplicate issues + +_Welcome to the course :tada:_ + +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. + +![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) + +With collaboraration 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. + +### Creating references + +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. + +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. + +### :keyboard: Activity: Find and close the cross-linked issue + +1. Navigate to the issue #1 (Welcome) +2. Type "Duplicate of #2" as a comment and close issue #1 +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. diff --git a/.github/steps/2-find-commit-in-history.md b/.github/steps/2-find-commit-in-history.md new file mode 100644 index 0000000..7c826f7 --- /dev/null +++ b/.github/steps/2-find-commit-in-history.md @@ -0,0 +1,33 @@ + + +## Step 2: Find a commit in history + +_Thanks for the duplicate note :wave:_ + +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? + +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. + +### What's `git blame`? + +`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. + +### What's a Secure Hash Algorithm (SHA)? + +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. + +### :keyboard: Activity: Find commit in history + +1. Navigate to the Code tab of your repository + - _Tip: you may have previously created your repository in a new tab_ +2. Click `docs` to navigate into the `/docs` directory +3. Click `_sidebar.md` to view the file +4. On the top of the file, click **Blame** to see the details of the most recent revision +5. Click the commit message, `add sidebar to documentation` to see the commit details +6. Copy the first seven characters of the SHA (the first 7 characters of the 40 character hexadecimal string listed after `commit`) +7. Comment on issue #2 by adding the SHA from step 6 as a comment text and click on "Comment" button +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. diff --git a/.github/steps/3-fix-broken-sidebar.md b/.github/steps/3-fix-broken-sidebar.md new file mode 100644 index 0000000..7f42489 --- /dev/null +++ b/.github/steps/3-fix-broken-sidebar.md @@ -0,0 +1,39 @@ + + +## Step 3: Fix a broken sidebar + +_Great job finding that commit :heart:_ + +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. + +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: + +- Who made the commit. +- What other changes were included. +- When the commit was made. +- Which pull request the commit was a part of. + +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? + +### Finding a pull request from a commit + +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. + +![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) + +### :keyboard: Activity: Fix a broken sidebar + +1. In the main branch [Edit the `docs/_sidebar.md` file](/docs/_sidebar.md). +2. Correct the spelling of the reference `(doc-references__.md)` on line 4 by changing it into `(doc-references.md)`. +3. Select or create a new branch `fix-sidebar` for this commit and start a pull request. +4. Make sure that **main** is selected for **base:** and **fix-sidebar** for **compare:**. +5. Using the **Assignees** section on the right side, assign yourself to the pull request. +6. In the PR comment add 'Closes #2' and autolink issue #2. +7. Click **Create pull request** and wait about 20 seconds. +8. Merge this pull request. +9. Delete the branch 'fix-sidebar'. +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. diff --git a/.github/steps/X-finish.md b/.github/steps/X-finish.md new file mode 100644 index 0000000..b8175a2 --- /dev/null +++ b/.github/steps/X-finish.md @@ -0,0 +1,31 @@ + + +## Finish + +_Congratulations friend, you've completed this course! :tada:_ + +celebrate + +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. + +### What's next? + +You can enable GitHub Pages and see `docs/index.html` as a website! + +1. Replace `USERNAME` with your GitHub username and `REPONAME` with your GitHub repository name in `docs/index.html`. +1. Under your repository name at the upper right, click :gear: **Settings**. +1. Then on the lower left, click **Pages**. +1. In the **GitHub Pages** section, select `main` in the **Select branch** drop-down menu and `/docs` in the **Select folder** drop-down menu. +1. Click the **Save** button. +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. + +Check out these resources to learn more or get involved: + +- Are you a student? Check out the [Student Developer Pack](https://education.github.com/pack). +- 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). +- [Take another GitHub Skills course](https://github.com/skills). +- [Read the GitHub Getting Started docs](https://docs.github.com/en/get-started). +- To find projects to contribute to, check out [GitHub Explore](https://github.com/explore). diff --git a/.github/workflows/0-welcome.yml b/.github/workflows/0-welcome.yml new file mode 100644 index 0000000..ac086b2 --- /dev/null +++ b/.github/workflows/0-welcome.yml @@ -0,0 +1,110 @@ +name: Step 0, Welcome + +# This step listens for the learner pushing a commit to `main`. +# This workflow updates from step 0 to step 1. + +# This will run every time we push a commit to `main`. +# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows +on: + workflow_dispatch: + push: + branches: + - main + +permissions: + contents: write + pull-requests: write + issues: write + +jobs: + # Get the current step to only run the main job when the learner is on the same step. + get_current_step: + name: Check current step number + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - id: get_step + run: | + echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT + outputs: + current_step: ${{ steps.get_step.outputs.current_step }} + + on_start: + name: On start + needs: get_current_step + + # We will only run this action when: + # 1. This repository isn't the template repository. + # 2. The step is currently 0. + # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts + # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions + if: >- + ${{ !github.event.repository.is_template + && needs.get_current_step.outputs.current_step == 0 }} + + # We'll run Ubuntu for performance instead of Mac or Windows. + runs-on: ubuntu-latest + + steps: + # We'll need to check out the repository so that we can edit the README. + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Let's get all the branches. + + # This is required to establish related issues + # after being created from the template repository. + - name: Prepare issues + run: | + echo "Make sure we are on step 0" + if [ "$(cat .github/steps/-step.txt)" != 0 ] + then + echo "Current step is not 0" + exit 0 + fi + echo "Create issue #1 from file" + gh issue create --title "Welcome" -F .github/files/issue01.md + echo "Create issue #2 from file" + gh issue create --title "Fix the sidebar" -F .github/files/issue02.md + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # This is required to create a relevant history for docs/_sidebar.md + # after being created from the template repository. + - name: Prepare files history + run: | + echo "Make sure we are on step 0" + if [ "$(cat .github/steps/-step.txt)" != 0 ] + then + echo "Current step is not 0" + exit 0 + fi + git config user.name github-actions + git config user.email github-actions@github.com + git checkout main + echo "Update _sidebar.md for the 1st time" + cp -f .github/files/_sidebar01.md docs/_sidebar.md + git add docs/_sidebar.md + git commit -m "updated _sidebar.md" + git push + echo "update _sidebar.md for the 2nd time" + cp -f .github/files/_sidebar02.md docs/_sidebar.md + git add docs/_sidebar.md + git commit -m "add sidebar to documentation" + git push + echo "preserve the commit shaw" + git log --all --oneline | grep "add sidebar to documentation" | cut -c 1-7 >> .github/files/SIDEBARCOMMIT + git add .github/files/SIDEBARCOMMIT + git commit -m "created SIDEBARCOMMIT" + git push + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # Update README from step 0 to step 1. + - name: Update to step 1 + uses: skills/action-update-step@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + from_step: 0 + to_step: 1 diff --git a/.github/workflows/1-resolve-duplicate-issues.yml b/.github/workflows/1-resolve-duplicate-issues.yml new file mode 100644 index 0000000..b654e69 --- /dev/null +++ b/.github/workflows/1-resolve-duplicate-issues.yml @@ -0,0 +1,74 @@ +name: Step 1, Resolve duplicate issues + +# This step listens for the learner creating or editing an issue comment. +# This workflow updates from step 1 to step 2. + +# This will run every time we create or edit an issue comment. +# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows + +on: + workflow_dispatch: + issue_comment: + types: [created, edited] + +permissions: + # Need `contents: read` to checkout the repository. + # Need `contents: write` to update the step metadata. + contents: write + +jobs: + # Get the current step to only run the main job when the learner is on the same step. + get_current_step: + name: Check current step number + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - id: get_step + run: | + echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT + outputs: + current_step: ${{ steps.get_step.outputs.current_step }} + + on_duplicate_issue_closed: + name: Check if duplicate issue is marked as duplicate + needs: get_current_step + + # We will only run this action when: + # 1. This repository isn't the template repository. + # 2. The step is currently 1. + # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts + # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions + if: >- + ${{ !github.event.repository.is_template + && needs.get_current_step.outputs.current_step == 1 }} + + # We'll run Ubuntu for performance instead of Mac or Windows. + runs-on: ubuntu-latest + + steps: + # We'll need to check out the repository so that we can edit the README. + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Let's get all the branches. + + - name: Dump GitHub comment context + id: github_comment_step + run: echo '${{ toJSON(github.event.comment) }}' + + - name: Dump GitHub issue context + id: github_issue_step + run: echo '${{ toJSON(github.event.issue) }}' + + - name: Check if commented issue is closed and marked as duplicate + if: ${{ contains(github.event.comment.body, 'Duplicate of') && (github.event.issue.state == 'closed')}} + run: echo 'Duplicate issue closed' + + # Update README from step 1 to step 2. + - name: Update to step 2 + uses: skills/action-update-step@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + from_step: 1 + to_step: 2 diff --git a/.github/workflows/2-find-commit-in-history.yml b/.github/workflows/2-find-commit-in-history.yml new file mode 100644 index 0000000..00d8d4b --- /dev/null +++ b/.github/workflows/2-find-commit-in-history.yml @@ -0,0 +1,77 @@ +name: Step 2, Find a commit in history + +# This step listens for the learner creating or editing an issue comment. +# This workflow updates from step 2 to step 3. + +# This will run every time we create or edit an issue comment. +# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows +on: + workflow_dispatch: + issue_comment: + types: [created, edited] + +permissions: + # Need `contents: read` to checkout the repository. + # Need `contents: write` to update the step metadata. + contents: write + +jobs: + # Get the current step to only run the main job when the learner is on the same step. + get_current_step: + name: Check current step number + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - id: get_step + run: | + echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT + - id: get_commit_id + run: | + echo "commit_id=$(cat ./.github/files/SIDEBARCOMMIT)" >> $GITHUB_OUTPUT + outputs: + current_step: ${{ steps.get_step.outputs.current_step }} + commit_id: ${{ steps.get_commit_id.outputs.commit_id }} + + on_fix_the_sidebar_issue_comment: + name: Check if the issue comment is referencing the correct commit ID + needs: get_current_step + + # We will only run this action when: + # 1. This repository isn't the template repository. + # 2. The step is currently 2. + # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts + # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions + if: >- + ${{ !github.event.repository.is_template + && needs.get_current_step.outputs.current_step == 2 }} + + # We'll run Ubuntu for performance instead of Mac or Windows. + runs-on: ubuntu-latest + + steps: + # We'll need to check out the repository so that we can edit the README. + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Let's get all the branches. + + - name: Dump GitHub comment context + id: github_comment_step + run: echo '${{ toJSON(github.event.comment) }}' + + - name: Dump GitHub issue context + id: github_issue_step + run: echo '${{ toJSON(github.event.issue) }}' + + - name: Check if the issue comment is referencing the required commit ID + if: contains(github.event.comment.body, needs.get_current_step.outputs.commit_id) + run: echo 'Found the reference to required commit in the comment' + + # Update README from step 2 to step 3. + - name: Update to step 3 + uses: skills/action-update-step@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + from_step: 2 + to_step: 3 diff --git a/.github/workflows/3-fix-broken-sidebar.yml b/.github/workflows/3-fix-broken-sidebar.yml new file mode 100644 index 0000000..cba000f --- /dev/null +++ b/.github/workflows/3-fix-broken-sidebar.yml @@ -0,0 +1,71 @@ +name: Step 3, Fix a broken sidebar + +# This step listens for the learner opening, editing, or reopening a pull request. +# This workflow updates from step 3 to step X. + +# This will run every time we open, edit, or reopen the pull request. +# Reference: https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows +on: + workflow_dispatch: + pull_request: + types: [opened, edited, reopened] + +permissions: + # Need `contents: read` to checkout the repository. + # Need `contents: write` to update the step metadata. + contents: write + +jobs: + # Get the current step to only run the main job when the learner is on the same step. + get_current_step: + name: Check current step number + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - id: get_step + run: | + echo "current_step=$(cat ./.github/steps/-step.txt)" >> $GITHUB_OUTPUT + outputs: + current_step: ${{ steps.get_step.outputs.current_step }} + + on_fix_the_sidebar_pr_body: + name: Check if the PR body is containing the correct closing message + needs: get_current_step + + # We will only run this action when: + # 1. This repository isn't the template repository. + # 2. The step is currently 3. + # Reference: https://docs.github.com/en/actions/learn-github-actions/contexts + # Reference: https://docs.github.com/en/actions/learn-github-actions/expressions + if: >- + ${{ !github.event.repository.is_template + && needs.get_current_step.outputs.current_step == 3 }} + + # We'll run Ubuntu for performance instead of Mac or Windows. + runs-on: ubuntu-latest + + steps: + # We'll need to check out the repository so that we can edit the README. + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Let's get all the branches. + + - name: Dump GitHub pull request context + id: github_pull_request_step + run: echo '${{ toJSON(github.event.pull_request) }}' + + - name: Check if the PR body is containing the required closing message + if: contains(github.event.pull_request.body, 'Closes') + run: echo "Found _Closes_ message with autolinked issue in the body of PR $NUMBER" + env: + NUMBER: ${{ github.event.pull_request.number }} + + # Update README from step 3 to step X. + - name: Update to step X + uses: skills/action-update-step@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + from_step: 3 + to_step: X diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..773bfd6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so + +# Packages # +############ +# it's better to unpack these files and commit the raw source +# git has its own built in compression methods +*.7z +*.dmg +*.gz +*.iso +*.jar +*.rar +*.tar +*.zip + +# Logs and databases # +###################### +*.log +*.sql +*.sqlite + +# OS generated files # +###################### +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..6c5bc3d --- /dev/null +++ b/LICENSE @@ -0,0 +1,7 @@ +Copyright (c) GitHub, Inc. + +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: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +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. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a13c68 --- /dev/null +++ b/README.md @@ -0,0 +1,76 @@ +
+ + + +# Connect the dots in a GitHub repository + +_Useful tips when navigating through your repository._ + +
+ + + +## Welcome + +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. + +- **Who is this for**: Developers, GitHub users, users new to Git, students, managers, and teams. +- **What you'll learn**: + - Find relevant issues and pull requests. + - Search history to find context. + - Make connections within GitHub to help others find things. +- **What you'll build**: Repository with existing commits, duplicated issues, and a content defect to be fixed. +- **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. +- **How long**: This course takes less than 15 min to complete. + +In this course, you will: + +1. Resolve a duplicate issue. +2. Find a commit in history. +3. Fix a broken sidebar. + +### How to start this course + + + +[![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) + +1. Right-click **Start course** and open the link in a new tab. +2. In the new tab, most of the prompts will automatically fill in for you. + - For owner, choose your personal account or an organization to host the repository. + - 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). + - Scroll down and click the **Create repository** button at the bottom of the form. +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. + + diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000..e69de29 diff --git a/docs/_sidebar.md b/docs/_sidebar.md new file mode 100644 index 0000000..0a5a597 --- /dev/null +++ b/docs/_sidebar.md @@ -0,0 +1,5 @@ +# Resources + +- [Learning resources](learning-resources.md) +- [Documentation references](doc-references.md) +- [Past work](past-work.md) diff --git a/docs/doc-references.md b/docs/doc-references.md new file mode 100644 index 0000000..87bb7f2 --- /dev/null +++ b/docs/doc-references.md @@ -0,0 +1,3 @@ +# Documentation References + +_List handy documentation references, like https://docsify.js.org._ diff --git a/docs/git-tips.md b/docs/git-tips.md new file mode 100644 index 0000000..c41ce97 --- /dev/null +++ b/docs/git-tips.md @@ -0,0 +1,249 @@ +# GIT tips + +# Fetch a file from another branch to the current one + +git checkout branch_name -- filename + +# Unstage all changes but leave files in the working directory untouched + +git reset HEAD + +# Unstage a file + +git reset HEAD + +# Go back to last commit and remove all changes from working directory + +git reset HEAD --hard + +# Delete untracked files + +git clean -f + +# Compare two branches + +git diff develop..master + +# Compare two commits + +git diff .. + +## Unstage file + +```bash +git reset filename +``` + +## Unstage deleted file + +```bash +git checkout HEAD filename +``` + +## Undo commit + +```bash +git reset --soft HEAD\^ +``` + +## Checkout remote branch + +```bash +git fetch origin +git checkout develop +``` + +## Go back to previous branch + +```bash +git checkout - +``` + +## Create empty master branch + +```bash +git branch -D master +git checkout --orphan master +``` + +## Tag the release + +```bash +# optional: tag important things, such as releases +git tag 1.0.0-RC1 +``` + +## Delete local tag + +```bash +git tag -d v0.2.0 +``` + +## Delete remote tag + +```bash +git push origin :refs/tags/v0.2.0 +``` + +## Amend last commit + +If you want to change the message of the latest commit do + +```bash +git commit --amend -m "New commit message" +``` + +## Revert specific file to previous version + +If you want to revert a specific file to its previous version do + +```bash +git checkout -- filename +``` + +## Undo all changes in branch + +If you want to reset all non-committed changes do + +```bash +git reset --hard +``` + +## Restore a file deleted in a previous commit + +If you want to restore a file deleted in a previous commit do + +```bash +git rev-list -n 1 HEAD -- +git checkout ^ -- +``` + +## Remove a file from a commit that has not been pushed + +If you want to remove a specific file from a commit that has not been pushed do + +```bash +git reset HEAD filename +``` + +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. + +## Checkout specific version of file + +You can also check out a particular version of a file + +```bash +git checkout v1.2.3 -- filename # tag v1.2.3 +git checkout stable -- filename # stable branch +git checkout origin/master -- filename # upstream master +git checkout HEAD -- filename # the version from the most recent commit +git checkout HEAD^ -- filename # the version before the most recent commit +``` + +## Remove a commit that has not been pushed + +```bash +git reset --hard HEAD^ +``` + +to reset to the previous commit before the current head; that way you don't have to be copying around commit IDs. + +## Revert a commit + +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. + +## Create a patch + +```bash +git commit ... +git checkout +git format-patch --stdout > fix_empty_poster.patch +git apply --stat fix_empty_poster.patch +git apply --check fix_empty_poster.patch +git am --signoff < fix_empty_poster.patch +``` + +or + +```bash +git diff > fix_empty_poster.patch +git apply fix_empty_poster.patch +``` + +## Sync a fork + +Add remote repository `upstream`. + +```bash +git remote add upstream https://github.com/trntv/yii2-starter-kit.git +``` + +Fetch latest commit from it + +```bash +git fetch upstream +``` + +Merge these commits to your repository + +```bash +git checkout master +git merge upstream/master +``` + +**IMPORTANT: there might be a conflicts between `upstream` and your code. You should resolve merging conflicts on your own** + +## Prune remote branches + +```bash +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 +``` + +## Submodules + +If you want to use someone else's repo as a Git Submodule on GitHub do + +```bash +git submodule add git://github.com/username/repo.git destination/folder +git submodule init +git submodule update +``` + +from the root of your project. + +## Stash + +```bash +git stash save +git stash save --include-untracked (-u) +git stash pop (git stash apply && git stash drop) +git stash apply (to re-use same stash later) +git stash list +git stash show +git stash apply +git stash branch testchanges +``` + +## Renaming branches + +If you want to rename a branch while pointed to any branch, do : + +``` +git branch -m +``` + +If you want to rename the current branch, you can do: + +``` +git branch -m +``` + +## git-extras + +```bash +git setup (from git-extras) +git ignore .DS_Store +git summary +git effort --above 10 +git undo +``` diff --git a/docs/index.html b/docs/index.html new file mode 100644 index 0000000..e6d9134 --- /dev/null +++ b/docs/index.html @@ -0,0 +1,23 @@ + + + + + + + + + + + +
+ + + + diff --git a/docs/learning-resources.md b/docs/learning-resources.md new file mode 100644 index 0000000..ca30ad5 --- /dev/null +++ b/docs/learning-resources.md @@ -0,0 +1,3 @@ +# Learning resources + +_List your favorite learning resources here._ diff --git a/docs/past-work.md b/docs/past-work.md new file mode 100644 index 0000000..88b3b6a --- /dev/null +++ b/docs/past-work.md @@ -0,0 +1,3 @@ +# Past work + +_Include references to your own completed Learning Labs or other work_.