🌿 Manage Git Branches

Efficiently handle your branches in Git with these essential commands. Use them to rename, delete, track, and review branches effectively.

✏️ Rename the Current Branch

Changes the name of the current branch to new-branch-name.

git branch -m new-branch-name

❌ Delete a Remote Branch

Deletes the remote branch named branch-name from the origin remote.

git push origin --delete branch-name

🔗 Track a Remote Branch

Creates and switches to a local branch that tracks origin/branch-name.

git checkout --track origin/branch-name

🔍 Show Branches Merged into the Current Branch

Displays branches fully merged into the current branch, helping identify branches that might be safe to delete.

git branch --merged

🚫 Show Branches Not Merged into the Current Branch

Lists branches that haven’t been merged into the current branch yet, useful for tracking pending work.

git branch --no-merged