Advanced Git Commands
Git is a powerful version control tool that not only tracks your code but also helps you collaborate efficiently. Once you’re comfortable with the basics, it's helpful to understand some of the more advanced commands and concepts to enhance your development workflow. Here’s a beginner-friendly overview of 10 important Git commands and features: 1. git diff Use: Shows the changes between files or commits. git diff Compare working directory with the staging area or latest commit. 2. git log Use: Displays the commit history of your repository. git log git log --oneline git log --graph --oneline --all You can see what changes were made, when, and by whom. 3. git clone Use: Creates a copy of a remote repository on your local machine. git clone https://github.com/user/repo.git 4. git fork Use: Creates your own copy of someone else's repository on GitHub. Done via GitHub UI. After forking, you can git clone it. 5. git pull Use: Fetches and merges changes from the remote repository. git pull origin main 6. git push Use: Pushes your local commits to the remote repository. git push origin main 7. git blame Use: Shows who last modified each line of a file. git blame filename 8. Git Merge Conflict Use: Happens when two branches have conflicting changes. Resolve manually. git merge branch-name # If conflict occurs: # Open file, fix conflicts (marked with >>>>>>), then: git add conflicted-file git commit 9. git branch Use: Create, list, or delete branches. git branch # List branches git branch new-feature # Create branch git checkout new-feature # Switch to branch git branch -d old-feature # Delete branch 10. .gitignore Use: Ignore files/folders from being tracked. Example .gitignore: node_modules/ .env *.log Tip: Mastering these commands helps you work smoothly in real-world projects and collaborate efficiently with teams.

Git is a powerful version control tool that not only tracks your code but also helps you collaborate efficiently. Once you’re comfortable with the basics, it's helpful to understand some of the more advanced commands and concepts to enhance your development workflow.
Here’s a beginner-friendly overview of 10 important Git commands and features:
1. git diff
Use: Shows the changes between files or commits.
git diff
Compare working directory with the staging area or latest commit.
2. git log
Use: Displays the commit history of your repository.
git log
git log --oneline
git log --graph --oneline --all
You can see what changes were made, when, and by whom.
3. git clone
Use: Creates a copy of a remote repository on your local machine.
git clone https://github.com/user/repo.git
4. git fork
Use: Creates your own copy of someone else's repository on GitHub.
Done via GitHub UI. After forking, you can
git clone
it.
5. git pull
Use: Fetches and merges changes from the remote repository.
git pull origin main
6. git push
Use: Pushes your local commits to the remote repository.
git push origin main
7. git blame
Use: Shows who last modified each line of a file.
git blame filename
8. Git Merge Conflict
Use: Happens when two branches have conflicting changes. Resolve manually.
git merge branch-name
# If conflict occurs:
# Open file, fix conflicts (marked with >>>>>>), then:
git add conflicted-file
git commit
9. git branch
Use: Create, list, or delete branches.
git branch # List branches
git branch new-feature # Create branch
git checkout new-feature # Switch to branch
git branch -d old-feature # Delete branch
10. .gitignore
Use: Ignore files/folders from being tracked.
Example .gitignore
:
node_modules/
.env
*.log
Tip: Mastering these commands helps you work smoothly in real-world projects and collaborate efficiently with teams.