My Complete Git Learning Journey

A Comprehensive Step-by-Step Guide to My Git and GitHub Learning Experience

Overview

This page documents my complete Git learning process — from installation to building a professional webpage. It includes every small detail, command, and challenge I faced while understanding Git and GitHub workflow. I explored concepts like initialization, commits, reverts, authentication tokens, branch management, and documentation.

1. Setup and Installation

Checking if Git is Installed

git --version

Verified that Git was installed on your system.

Learning Basic Terminal Commands

cd <folder_name>
ls -a

Learned to navigate folders, list hidden files, and understand the difference between working directory and Git repository.

Creating a Local Git Repository

git init

Initialized Git for my project folder, creating a hidden .git directory for version tracking.

Configuring User Details

git config --global user.name "Username"
git config --global user.email "tocken"

Creating and Tracking Files

git add .
git commit -m "Added new-file"

Understood the concepts of staging (add) and committing changes.

2. Exploring Git Commands

Checking Status and Logs

git status
git log

Learned how to check modified files, commit history, and author details.

Comparing Changes

git diff
git diff c3.txt

Viewing Branches

git branch

Switching Branches

git checkout <branch>

Typical Git Workflow


git status
git add .
git commit -m "Commit message"
git push
      

3. Reverting, Resetting, and Fixing Conflicts

Undoing Mistakes

git revert <commit-id>

Learned the difference between git revert, git reset, and git checkout.

Fixing Merge Conflicts

CONFLICT (modify/delete): c3.txt deleted in parent and modified in HEAD

Resolved manually, marked the resolution with git add, and continued with git revert --continue.

4. Working with GitHub and Remotes

Adding Remote Repository

git remote add origin https://github.com/Username/Old_repository.git
git push -u origin master

Switching to a New Repository

git remote remove origin
git remote add origin https://github.com/Username/new_repository.git

Branch Mismatch (main vs master)

error: src refspec master does not match any
git branch
git push -u origin main

Authentication with Personal Access Token (PAT)

Created a fine-grained PAT on GitHub with:

Used this token instead of a password for pushing changes.

Understanding Tokens

Learned that a single token with "All repositories" access can be reused for all repositories.

5. Troubleshooting and Errors

Push Rejection (fetch first)

! [rejected] main -> main (fetch first)

Resolved by syncing local and remote repositories:

git fetch origin
git pull origin main --rebase
git push origin main

“Everything Up to Date” Issue

git add .
git commit -m "Added new file"
git push

Invalid Username or Token Error

Invalid username or token. Password authentication is not supported.

Branch Conflicts

Understood how to check remote status, rebase, and resolve sync issues.

6. Final Understanding and Outcome

  • Mastered Git’s complete workflow: init → add → commit → push → pull → revert
  • Learned branch management and remote syncing
  • Handled GitHub authentication using PAT
  • Successfully built a public Git learning project: git-for-beginners

This project represents a complete learning journey in Git and GitHub, combining technical understanding, practical commands, troubleshooting experience, and professional documentation.