🚀 Level Up with These 10+ Useful Git Commands

By Rajaram

Git is a powerful tool for developers — not just for saving your code, but for managing versions, collaborating, and resolving issues like a pro. In this post, let’s walk through some essential and advanced Git commands that can boost your workflow.


1. 🔍 git diff

Purpose: Show changes between files, commits, or branches.

Use Case: Compare your working directory with the index or a previous commit.

git diff

2. 📜 git log

Purpose: Display the full commit history.

Use Case: Track changes, find specific commits, or understand project history.

git log

3. 📥 git clone

Purpose: Clone a remote repository to your local machine.

git clone https://github.com/rajaramnivas/24MCR080

4. ⬇ git pull

Purpose: Fetch and merge changes from the remote repo to your current branch.

git pull origin main

5. ⬆ git push

Purpose: Push your local commits to the remote repository.

git push origin main

6. 🕵 git blame

Purpose: Show who last modified each line of a file and when.

Use Case: Great for debugging or understanding change history.

git blame ML.txt

7. ⚔ Merge Conflicts (Concept)

Note: Merge conflicts happen when two branches modify the same part of a file.

To simulate a merge conflict:

git checkout -b new-branch
# Make changes, commit them
git checkout main
# Make conflicting changes
git merge new-branch
# Conflict occurs here

You'll need to manually resolve the conflict in the files and commit the resolution.


8. 🌿 git branch

Purpose: List, create, or delete branches.

git branch             # List branches  
git branch feature     # Create a branch  
git branch -d feature  # Delete a branch

9. 🚀 git checkout -b

Purpose: Create and switch to a new branch in one step.

git checkout -b advanced-git-commands

10. 📁 .gitignore

Purpose: Tell Git which files or folders to ignore in version control.

Steps to set up:

  1. Create a .gitignore file in your root directory.
  2. Add patterns of files or folders to ignore.

Example:

*.log
node_modules/
.env

No command is needed — Git will automatically skip tracking files that match the patterns.


💼 Bonus Tip: git stash

Purpose: Temporarily save your changes when you're not ready to commit but need to switch branches.

git stash
git stash pop  # To apply them back

🔗 Bonus: GitHub Repo

You can check out the repository related to this guide here:

👉 GitHub - 24MCR080


💡 Final Thoughts

These Git commands may look simple, but mastering them gives you better control, cleaner workflows, and confidence when collaborating with teams. Whether you're debugging, exploring history, or working on features — Git's got your back.


🙌 Thanks for reading!

If you found this helpful, leave a ❤️ or drop your favorite Git command in the comments!

git #github #beginners #productivity #programming