Skip to main content

🔧 Top 20 Git Commands

Top 20 Git Commands

1. Initialize Git Repo

git init — Initializes a new, empty Git repository in your current folder. Creates a hidden .git directory to track versions of your files.

2. Clone a Repository

git clone <url> — Creates a copy of a remote repository (like from GitHub) on your local machine. The <url> can be HTTPS or SSH.

Interview

3. Check Repo Status

git status — Displays the state of your working directory and staging area. Shows which files are modified, staged, or untracked.

4. Stage Files

git add . — Stages all changes (new, modified, deleted) in the current directory for the next commit.

5. Commit Changes

git commit -m "message" — Takes a snapshot of the staged changes and saves it to the repository with a custom message.

Interview

6. View Commit History

git log — Lists all commits in the current branch along with author, date, and message. Useful for tracking changes over time.

7. Create Branch

git branch new-feature — Creates a new branch called new-feature but does not switch to it.

8. Switch Branch

git checkout main — Changes your working directory to the main branch (or any other specified branch).

9. Create & Switch

git checkout -b new-feature — Creates and immediately switches to the new-feature branch. Shortcut for branching and switching.

Interview

10. Merge Branches

git merge new-feature — Combines the changes from new-feature branch into the branch you're currently on.

11. Pull Changes

git pull — Fetches updates from the remote repository and merges them with your local copy in one step.

12. Push Changes

git push — Uploads your local commits to the remote repository (e.g., GitHub) for others to see and collaborate.

Interview

13. Delete Branch

git branch -d branch-name — Deletes a branch locally. Use -D to force delete even if it’s not merged.

14. Stash Changes

git stash — Temporarily saves your uncommitted changes, letting you work on something else without committing.

15. Apply Stash

git stash apply — Reapplies the most recent stashed changes to your working directory.

16. View Remote URLs

git remote -v — Lists all remotes for the repo with URLs for fetch and push operations.

17. Set Remote Origin

git remote add origin <url> — Links your local repo to a remote one, usually on GitHub. origin is just the default name.

Interview

18. View File Changes

git diff — Shows line-by-line differences between your working files and the staging area or previous commits.

19. Reset Commit

git reset --soft HEAD~1 — Undoes the most recent commit but keeps your files staged for a new commit.

Interview

20. Revert Commit

git revert <commit-id> — Creates a new commit that undoes the changes made in a previous one. Safer than reset for shared branches.

Popular posts from this blog

SSC MTS Slot Booking 2025–2026: Exam City Selection Date, Last Date & Complete Process

  SSC MTS Slot Booking 2025–2026: Exam City Selection Date, Last Date & Complete Process The Staff Selection Commission (SSC) conducts the Multi Tasking Staff (MTS) and Havaldar Examination every year for recruitment in various central government departments. One of the most important steps before downloading the admit card is SSC MTS Slot Booking / Exam City Selection . In this article, you will get complete and correct information about SSC MTS Slot Booking 2025–2026 , including expected dates, last date, step-by-step process, and common mistakes to avoid. What is SSC MTS Slot Booking? SSC MTS Slot Booking , also known as Exam City Selection , is the process where candidates choose: Preferred exam city Exam date (if multiple dates are available) ⚠️ Important: SSC does not allow exam center change after slot booking . SSC MTS Slot Booking Date 2025–2026 (Expected) As per previous SSC trends: Event Expected Date Exam City / Slot Booking Start January 2026 ...

🔗 How to Increase LinkedIn Connections – 10 Real Tips

1. Optimize Your Profile Your LinkedIn profile is like your digital resume. Use a professional and clear profile photo with good lighting and a friendly expression. Add a custom banner that reflects your interests or field. Craft a compelling headline (not just your job title) that describes what you do or what you're aspiring to do. In the "About" section, write a short and impactful summary highlighting your skills, goals, achievements, and what you're passionate about. Keep it genuine, structured, and focused. 2. Add Your Real Network First Start by connecting with people you already know in real life — college friends, professors, past coworkers, classmates, event attendees, and acquaintances. This builds a strong foundation and also helps the algorithm suggest better connections. Having a real network also makes you appear more credible when new people view your profile. 3. Personalize Connection Requests Always cu...

Top Website to Build Resumes

Top 15 Resume Builder Websites 📄 Top 15 Websites to Build Your Resume – Free & Easy 1. Canva canva/resumes – One of the easiest tools with drag-and-drop functionality. Choose from a huge library of visually appealing resume templates. You can customize fonts, colors, icons, and even add charts or images to make your resume stand out creatively. 2. Novoresume novoresume – Offers professional resume formats that are ATS (Applicant Tracking System) friendly. It includes smart content suggestions and layouts tailored for different career levels, from students to executives. 3. Zety zety/resume-builder – A guided resume builder that walks you through each section with expert tips. It includes writing suggestions for each field and also offers templates for cover letters and CVs. 4. ResumeGenius resumegenius – Ideal for users who need quick output. It builds resumes through a step-by-step questionnaire and generates well-struct...