Back to articles
Step-by-Step Git Commands Guide
How-ToTools

Step-by-Step Git Commands Guide

via Dev.toSatish

Managing Git repositories effectively requires knowing the right commands in the right order. Here’s a practical roadmap you can follow, formatted for a dev.to style post. 🏁 Initial Setup git config --global user.name "Your Name" git config --global user.email "your@email.com" # Initialize a new repository git init # Add a remote GitHub repo git remote add origin https://github.com/username/repo.git 📂 Basic Workflow # Check repo status git status # Stage files git add filename.js git add . # add all files # Commit changes git commit -m "Initial commit" # Push to remote (main branch) git push origin main 🌿 Branching # Create new branch git branch develop # Switch to branch git checkout develop # Create + switch in one step git checkout -b feature/login-auth # List branches git branch 🔄 Merging # Merge feature into develop git checkout develop git merge feature/login-auth # Merge staging into main git checkout main git merge staging 📡 Syncing with Remote # Pull latest changes git pull or

Continue reading on Dev.to

Opens in a new tab

Read Full Article
0 views

Related Articles