ML DAY 1 (24MCR019)

STEP-BY-STEP GIT COMMANDS EXECUTION INITIALIZE A GIT REPOSITORY: git init Creates a new Git repository in the folder 24MCR019. ADD A FILE TO STAGING AREA: git add ML.txt Adds ML.txt to the staging area. COMMIT THE FILE: git commit -m "added personal details" Creates a commit with the message "added personal details". CHECK GIT STATUS: git status Shows that ML.txt has been modified but not staged. VIEW COMMIT LOG: git log Displays the commit history (one commit at this point). ADD REMOTE GITHUB REPOSITORY: git remote add origin https://github.com/dharshini-vel/24MCR019.git Links the local repository to a remote GitHub repo. CHECK CURRENT BRANCH: git branch Shows the current branch is master. RENAME BRANCH FROM MASTER TO MAIN: git branch -M main Renames the current branch to main. SET GIT GLOBAL CONFIG FOR EMAIL AND USERNAME: git config --global user.email "dharshini56k@gmail.com" git config --global user.name "dharshini-vel" Sets your global Git identity. PUSH CODE TO REMOTE REPO FOR THE FIRST TIME: git push -u origin main Pushes the main branch to GitHub and sets upstream tracking. Then , Again We will Modify or add new file means we need to follow the same steps, like git add . git commit -m “message” git push origin main

Apr 26, 2025 - 16:29
 0
ML DAY 1 (24MCR019)

STEP-BY-STEP GIT COMMANDS EXECUTION

INITIALIZE A GIT REPOSITORY:
git init
Creates a new Git repository in the folder 24MCR019.

ADD A FILE TO STAGING AREA:
git add ML.txt
Adds ML.txt to the staging area.

COMMIT THE FILE:
git commit -m "added personal details"
Creates a commit with the message "added personal details".

CHECK GIT STATUS:
git status
Shows that ML.txt has been modified but not staged.

VIEW COMMIT LOG:
git log
Displays the commit history (one commit at this point).

ADD REMOTE GITHUB REPOSITORY:
git remote add origin https://github.com/dharshini-vel/24MCR019.git
Links the local repository to a remote GitHub repo.

CHECK CURRENT BRANCH:
git branch
Shows the current branch is master.

RENAME BRANCH FROM MASTER TO MAIN:
git branch -M main
Renames the current branch to main.

SET GIT GLOBAL CONFIG FOR EMAIL AND USERNAME:
git config --global user.email "dharshini56k@gmail.com"
git config --global user.name "dharshini-vel"
Sets your global Git identity.

PUSH CODE TO REMOTE REPO FOR THE FIRST TIME:
git push -u origin main
Pushes the main branch to GitHub and sets upstream tracking.

Then , Again We will Modify or add new file means we need to follow the same steps, like

git add .
git commit -m “message”
git push origin main