Anton Nekrutenko
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    --- tags: BMMB554-23 --- [![](https://imgs.xkcd.com/comics/git_commit.png)](https://xkcd.com/1296) # Lecture 14: GitHub and Git :::info The assumption here is that you have configured authentication so that you can push changes from your local repository to GitHub's remote! ::: ## Clone, change, push ### Clone a repo First we will clone a copy of the repository you forked on Tuesday by executing `git clone` and git inside it: ```bash= git clone git@github.com:[YOUR GITHUB HANDLE]/bmmb554_foo_bar.git cd bmmb554_foo_bar ``` :::warning Just make sure you replace `YOUR GITHUB HANDLE` with, urg, your GitHub handle! ::: ### Make a few changes Edit `README.md` by adding any text you want (e.g., 'making some changes') and also create a new directory called `docs`: ```bash= mkdir docs ``` now inside the `docs` create a new file called `index.html` and past the following content in it: ```html= <!DOCTYPE html> <html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p> </body> </html> ``` ### `add` and `commit` Make sure you are at the root of your local repo. And then: ```bash= $ git status On branch main Your branch is up to date with 'origin/main'. Changes not staged for commit: (use "git add <file>..." to update what will be committed) (use "git restore <file>..." to discard changes in working directory) modified: README.md Untracked files: (use "git add <file>..." to include in what will be committed) docs/ no changes added to commit (use "git add" and/or "git commit -a") $ git add README.md $ git add docs/* $ git status On branch main Your branch is up to date with 'origin/main'. Changes to be committed: (use "git restore --staged <file>..." to unstage) modified: README.md new file: docs/index.html $ git commit -m 'changed README and added docs' [main a5fdbae] changed REDAME and added docs 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 docs/index.html ``` ### `push` ! Since we have authentication working, let's push: ```bash= $ git push Enumerating objects: 7, done. Counting objects: 100% (7/7), done. Delta compression using up to 8 threads Compressing objects: 100% (4/4), done. Writing objects: 100% (5/5), 639 bytes | 639.00 KiB/s, done. Total 5 (delta 0), reused 0 (delta 0), pack-reused 0 To github.com:nekrut/bmmb554_foo_bar.git de89f51..a5fdbae main -> main ``` ### Go to GitHub and see the changes ![](https://i.imgur.com/c82FZTb.png) ### Enable GitHub Pages - Click "Settings" ![](https://i.imgur.com/X7fYSvV.png) - Click "Pages" ![](https://i.imgur.com/9BIJPZh.png) - Set "Barnch" to `main` and directory to `docs` ![](https://i.imgur.com/AoAuSYy.png) After a minute or so you will be able to go to `https://[YOUR GITHUB HANDLE].github.io/bmmb554_foo_bar` and see something like this: ![](https://i.imgur.com/Q8KUtf8.png) :tada: :tada: :tada: :tada: :tada: :tada: :tada: :tada: :tada: :tada: :tada: :tada: :tada: ## Create a meaningful website We will create a web page using markdown and hackmd. ### What is markdown? [Markdown](https://en.wikipedia.org/wiki/Markdown) is a lightweight markup language that is used to format text in a simple and easy-to-read way. It was created by John Gruber in 2004 and has become widely used in documentation, web pages, and other text-based documents. Markdown allows you to add formatting elements to plain text using a few simple syntax rules. For example, you can add headings by using the "#" symbol at the beginning of a line, add emphasis to text by using asterisks or underscores, and create lists by using dashes or numbers. ### What is HackMd? [HackMD](htpps://hackmd.io) is a collaborative, web-based markdown editor that allows multiple users to work on a document in real-time. It is similar to other collaborative writing tools, such as Google Docs or Microsoft Office 365, but with a focus on markdown formatting. HackMD provides a simple and intuitive interface for editing markdown text. You can create headings, add emphasis, create lists, add images, and more using the markdown syntax. You can also collaborate with others in real-time, with changes appearing instantly on everyone's screens. One of the unique features of HackMD is the ability to create "live" documents, which are documents that allow you to run code, create interactive visualizations, and embed multimedia content directly within the markdown text. This makes HackMD an ideal tool for creating technical documentation, tutorials, and interactive educational materials. HackMD also supports integration with other tools, such as GitHub, Dropbox, Google Drive, and more, allowing you to easily import and export documents to and from other platforms. HackMD is available both as a web-based application and as a self-hosted solution that you can run on your own server. It is used by developers, educators, and teams across various industries for collaborative writing, note-taking, and technical documentation. ### Sign up with HackMd and create a page For this go to https://hackmd.io and sign up for an account. Note that you can sign up using your GitHub credentials. Once you are done, let's go through [HackMd markdown syntax reference](https://hackmd.io/c/codimd-documentation/%2F%40codimd%2Fmarkdown-syntax). You can now go ahead and create a page! ### Deploy a page on GitHub We will now go through the following steps: - Save webpage as HTML - Move it to replace `index.html` in the `docs/` directory of your repo - Push to GitHub ## The PR workflow A pull request is a feature of version control systems, such as Git, that allows developers to propose changes to a codebase hosted in a shared repository. When a developer wants to contribute to a project, they will create a copy of the project (a "fork"), make changes to the codebase in their own copy, and then submit a pull request to the original project's maintainers. The pull request includes a summary of the changes made, any relevant documentation or tests, and a request for the maintainers to review the changes and merge them into the original project. The maintainers can then review the proposed changes, leave comments or suggest modifications, and ultimately decide whether or not to merge the changes into the project. This process allows for collaboration and code review, and ensures that changes to a codebase are thoroughly reviewed and tested before being added to the main codebase. ### Let's do a PR against the repo of this course To do this: - Clone https://github.com/nekrut/BMMB554 - Create a new branch - Make some changes - Push - Create a PR

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully