1. git init

Description:
Initializes a new Git repository in your project directory.

Command:

git init

Screenshot:

init


2. git add

Description:
Stages changes (files or updates) to be committed.

Command:
git add

To stage all files

git add .

Screenshot:

add


3. git commit

Description:

Records the staged changes to the repository with a message.

Command:
git commit -m "Your commit message"

Screenshot:

commit


4. git status

Description:

Displays the state of the working directory and staging area.

Command:
git status

Screenshot:
status


5. git log

Description:

Shows the commit history for the current branch.

Command:
git log

Screenshot:
log


6. git remote add origin

Description:
Adds a remote repository (such as one on GitHub) to your local repository.

Command:
git remote add origin https://github.com/username/repository.git

Screenshot:
Create repository in your GitHub account

Push an existing repository from the command line<br>


7. git branch

Description:
Lists all branches or creates a new branch.

Command:
git branch

Create a new branch

git branch

Screenshot:

branch


8. git branch -M

Description:

Renames the current branch to a new name.

Command:
git branch -M main

Screenshot:

change branch


9. git config --global user.name

Description:

Sets your Git username globally on your machine.

Command:
git config --global user.name "Your Name"

Screenshot:
username


10. git config --global user.email

Description:

Sets your Git email globally on your system.

Command:
git config --global user.email "you@example.com"

Screenshot:

email


11. git push

Description:
Uploads your committed changes to a remote repository like GitHub.

Command:
git push origin main

Screenshot:
push

Committed

Inserted File

Commit Changes

Commit History

File after commit changes