Activity #2 Git Fundamentals Documentation on Hashnode.com

What is Git?
Git is a distributed version control system that I’ve found incredibly useful for tracking changes in my projects. It allows multiple developers to work together without the worry of overwriting each other’s changes.

Basic Git Commands

  • Initializing a Repository

git init

This command creates a new Git repository in your current directory, setting it up for version control.

Create Repository in your Github

  • Cloning a Repository

git clone <repository-url>

After you created your repository in Github, copy your repository link then add it in the code above, use this command to copy the repository to your local machine along with all its history and branches.

  • Checking Status

git status

Run this command to check the status of your files, which tells you what’s staged, unstaged, or untracked.

  • Staging Changes

git add <file>

Use this command to stage specific files, preparing them for next commit. Just add a file for example you want to add or if there’s a specific file inside your directory you want to add, use the code above and replace the “<file>“ with the name of your file.

The file I use in this image is an example only

  • Committing Changes

git commit -m "Your commit message"

This is how Ito save changes to the local repository, along with a message that summarizes what you did.

Make the Initial Commit, If files are staged successfully, commit them:

  • Pushing Changes

git push origin <branch-name>

Use this command to upload your commits to a remote repository

To push your local changes to the main branch of the remote repository, use:

git push -u origin main

(If your default branch is master, then replace it into main with master.)

After everything, I have committed the files “anjdbhw.docx” and pushed them to my GitHub repository.

LINK TO MY GITHUB REPOSITORY:
https://github.com/MonetForProgrammingPurposes/Git-Fundamentals