USEFUL GIT COMMANDS

✅1. git diff Description: Shows the differences between files in your working directory and the index (staging area). Command: git diff Screenshot: ✅2. git log Description: Displays the commit history of the current branch with details such as commit ID, author, and date. Command: git log Screenshot: ✅3. git clone Description: Clones an existing remote Git repository into a local directory. git clone https://github.com/username/repository.git Command: git clone https://github.com/jayalakshmis04/jayalakshmis04.git Screenshot: ✅4. git fork Description: Creates a personal copy of someone else's repository into your GitHub account. Note: This is done from the GitHub interface, not the command line. Command: No terminal command; click "Fork" on the top right of a GitHub repository. Screenshot: ✅5. git pull Description: Fetches and integrates changes from the remote repository into the current branch. Command: git pull origin main Screenshot: ✅6. git push Description: Sends committed changes to a remote repository like GitHub. Command: git push origin main Screenshot: ✅7. git blame Description: Shows who last modified each line of a file and when. Command: git blame filename Screenshot: ✅8. git merge conflict Description: Occurs when changes from different branches conflict during a merge. Command to simulate: Make conflicting changes in two branches git merge feature-branch Screenshot: Conflicted File: ✅9. git branch Description: Lists existing branches or creates a new one. Command: git branch To create a new branch git branch new-branch Screenshot: ✅10. git ignore Description: Used to exclude files and directories from version control by specifying them in a .gitignore file. Command: Create or edit .gitignore file and add the filenames or patterns to exclude. Example: node_modules/ *.log .env Screenshot:

Apr 24, 2025 - 20:53
 0
USEFUL GIT COMMANDS

✅1. git diff

Description:

Shows the differences between files in your working directory and the index (staging area).

Command:
git diff

Screenshot:

git diff

✅2. git log

Description:

Displays the commit history of the current branch with details such as commit ID, author, and date.

Command:
git log

Screenshot:

git log

✅3. git clone

Description:

Clones an existing remote Git repository into a local directory.
git clone https://github.com/username/repository.git

Command:
git clone https://github.com/jayalakshmis04/jayalakshmis04.git

Screenshot:

git clone

✅4. git fork

Description:

Creates a personal copy of someone else's repository into your GitHub account.

Note: This is done from the GitHub interface, not the command line.

Command:

No terminal command; click "Fork" on the top right of a GitHub repository.

Screenshot:

fork

create fork

forking

Repository Copied

✅5. git pull

Description:

Fetches and integrates changes from the remote repository into the current branch.

Command:
git pull origin main

Screenshot:

git pull

✅6. git push

Description:

Sends committed changes to a remote repository like GitHub.

Command:
git push origin main

Screenshot:

push

✅7. git blame

Description:

Shows who last modified each line of a file and when.

Command:
git blame filename

Screenshot:

blame

✅8. git merge conflict

Description:

Occurs when changes from different branches conflict during a merge.

Command to simulate:

Make conflicting changes in two branches

git merge feature-branch

Screenshot:

Switch branch

Conflicted File:
conflict

✅9. git branch

Description:

Lists existing branches or creates a new one.

Command:
git branch

To create a new branch

git branch new-branch

Screenshot:

branch

✅10. git ignore

Description:

Used to exclude files and directories from version control by specifying them in a .gitignore file.

Command:

Create or edit .gitignore file and add the filenames or patterns to exclude.

Example:
node_modules/
*.log
.env

Screenshot:

.gitignore