Brief but complete overview of essential Git commands for pushing a project and maintaining it over time.
git init # Initialize a local Git repo
git remote add origin <repo-url> # Connect to GitHub repo (HTTPS/SSH)
git add . # Stage all files
git commit -m "Initial commit" # Commit with a message
git branch -M main # Rename current branch to main (optional)
git push -u origin main # Push to GitHub (first time)git status # Check current status
git add <file> # Stage specific file(s)
git add . # Or stage all changes
git commit -m "Meaningful message" # Commit staged changes
git push # Push to the remote branchgit branch # List branches
git switch branch_name # Switch to a branch
git switch -c new_branch # Create and switch to new branch
git push -u origin new_branch # Push new branch to remotegit pull origin main # Get latest changes from main
git fetch # Fetch all branches and tags from remote
git merge origin/main # Merge main into current branchgit switch main # Go to main branch
git merge feature_branch # Merge feature into main
git push # Push updated maingit branch -d branch_name # Delete local branch
git push origin --delete branch_name # Delete remote branchgit log # See commit history
git remote -v # View remote URLs
git config user.name "Your Name" # Set Git name
git config user.email "your@email.com" # Set Git email