Day 2 - GIT commands
Creating Git Folder: Now, let's create a new folder for our project mkdir Projectname cd Projectname mkdir makes a new directory. cd changes the current working directory. Clone an Existing Repository: Copies a remote repository to your local machine. git clone This is useful when you want to contribute to an existing project. Check the Status of Your Repository: Shows which files have been modified, staged, or untracked. git status Always run this before committing to see what’s changed. Add Files to Staging: Moves changes from the working directory to the staging area. git add # Add a specific file git add . # Add all changes Staging means preparing files to be committed. Commit Changes: Saves the staged changes permanently in the repository. git commit -m "Your commit message" The commit message should describe what changes were made. Check Your Git Configuration: To verify your Git username and email, run: git config --global user.name git config --global user.email List All Branches: Shows all available branches in the repository. git branch The current branch will have a * next to it. Create a New Branch: Creates a new branch without switching to it. git branch Branches help in working on different features separately. Switch to Another Branch: Moves to an existing branch. git checkout Check Commit History: Shows a list of all previous commits. git log Show Changes in Files: Compares modified files with the last committed version. git diff

Creating Git Folder:
Now, let's create a new folder for our project
mkdir Projectname
cd Projectname
mkdir makes a new directory.
cd changes the current working directory.
Clone an Existing Repository:
Copies a remote repository to your local machine.
git clone
This is useful when you want to contribute to an existing project.
Check the Status of Your Repository:
Shows which files have been modified, staged, or untracked.
git status
Always run this before committing to see what’s changed.
Add Files to Staging:
Moves changes from the working directory to the staging area.
git add # Add a specific file
git add . # Add all changes
Staging means preparing files to be committed.
Commit Changes:
Saves the staged changes permanently in the repository.
git commit -m "Your commit message"
The commit message should describe what changes were made.
Check Your Git Configuration:
To verify your Git username and email, run:
git config --global user.name
git config --global user.email
List All Branches:
Shows all available branches in the repository.
git branch
The current branch will have a * next to it.
Create a New Branch:
Creates a new branch without switching to it.
git branch
Branches help in working on different features separately.
Switch to Another Branch:
Moves to an existing branch.
git checkout
Check Commit History:
Shows a list of all previous commits.
git log
Show Changes in Files:
Compares modified files with the last committed version.
git diff