Rename Git Branch to Main with git branch -M

🌿 Understanding git branch -M main If you're setting up your repository, you’ll often see this command used early on. Let’s break it down 👇 🔹 The Command git branch -M main 🔹 What it does Renames your current branch to main The -M flag means force rename (even if a branch named main already exists) 🔹 Why use it? Git used to default to master, but now main is the standard Keeps your repo consistent with modern practices and platforms like GitHub 🔹 When to use it? Right after git init Before pushing your project to GitHub 💡 Pro Tip: Check your current branch using: git branch Now your project is aligned with modern Git standards 🚀 #Git #GitHub #Programming #Developers #CodingTips #Python #WebDevelopment

To view or add a comment, sign in

Explore content categories