HTML Source Code: View on GitHub

Git & GitHub Crash Course: Create a Repository From Scratch!

Course Link

Intro

30-minute free Git and GitHub crash course!

Who this course is for:

Web developers unfamiliar with Git and GitHub or those who've heard of them but don't know where to start.

Core Lessons (Under 30 minutes)

Content Highlights

① What is a repository?

repo = repository (where store your stuff)

README is a front page where everyone reads.

Git for Windows > I have WSL2 installed before.

② Make your changes live on GitHub

③ Repositories Terminologies:

  1. Cloning
  2. Staging (inside the box and about to ship over to GitHub)
  3. Committing (It’s when take staged files and slap a “this is done” label on it before sending it to GitHub)
  4. Repositories

Pushing (Is the act of sending files from the computer to GitHub)

As of August 13, 2021, GitHub no longer accepts account passwords when authenticating Git operations. Instead, use personal access tokens (PATs) or SSH keys.

Naming difference observed—main versus master—is due to a change by GitHub in late 2020. The default branch name for new repositories changed from master to main for inclusivity.

Please tell me who you are.
Run:
1) git config --global user.email "you@example.com"
2) git config --global user.name "Your Name"

④ Command Line

git diff README.md

git log

way better [git log] method

git lg - Coding For Everybody

git log --topo-order --all --graph --date=local --pretty=format:'%C(green)%h%C(reset) %><(55,trunc)%s%C(red)%d%C(reset) %C(blue)[%an]%C(reset) %C(yellow)%ad%C(reset)%n'

succeeded add this to .ipconfig to the computer

Need to synchronize your local repository with the remote repository before you can push your changes. Here's how to do it:
**Pull the Latest Changes**

git checkout
git checkout Commit Hash (Commit ID)
git checkout main

⑤ Future Learning :

Plug in for Visual Studio & Learn programming language.

More learning

way better [git log] method

Git Essentials — The step-by-step guide to Git mastery | Udemy

http://gitforeverybody.com/

⑥ Syncing Your Local Repository with GitHub

  1. Navigate to Your Local Repository

    Command: cd \Users\CHAIBENG\AI\My_Portfolio_Github

  2. Verify Remote Repository

    Command: git remote -v

  3. Fetch Changes from GitHub

    Before making any changes, it's always a good idea to fetch the latest changes from GitHub. This won’t merge the changes into your local repository, but it will update your remote-tracking branches.

    Command: git fetch origin

  4. Check Out the Correct Branch

    Ensure you are on the correct branch. If you're unsure which branch to use, it's usually the main or master branch. You can check your current branch with:

    Command: git branch

  5. Pull Changes from GitHub

    Pull the changes from GitHub to your local repository. This will merge the changes from the remote branch to your local branch:

    Command: git pull origin [branch-name]

  6. Commit and Push Your Local Changes

    Command:

    git add .

    git commit -m "Your commit message"

    Then, push your changes to GitHub:

    Command: git push origin [branch-name]

  7. Verify Sync

    Finally, verify that your local repository is in sync with your GitHub repository by visiting https://github.com/m-chuu/MyPortfolioRepo.

⑥ Creating a repository on GitHub and uploading your code to it

  1. Run git init. This initializes a new Git repository in your project directory
  2. Connect Your Local Repository to GitHub

    Command: git remote add origin

  3. Add Your Files to the Local Git Repository

    Command: git add .

  4. Commit the Files

    Command: git commit -m "Initial commit"

  5. Push the Changes to GitHub

    Command: git push -u origin master