Back to blog
Git and Github
May 8, 2026programming

Git and Github

The Most Essential Commands Just getting started with Git? Here are the commands you'll use 90% of the time. --- ⚙️ INITIAL SETUP ```git config --global user.name "Your Name"``` → Sets your username globally ```git config --global user.email "you@email.com"``` → Associates your email with every commit --- 📁 REPOSITORY & STAGING ```git init``` → Initializes a new repository in the current folder ```git clone url``` → Clones a remote repository to your machine ```git status``` → Shows the current state of your working tree ```git add .``` → Stages all modified files for the next commit --- 💾 COMMITS & HISTORY ```git commit -m "message"``` → Saves your changes with a descriptive message ```git log --oneline``` → Shows commit history in a compact format ```git diff``` → Displays differences in modified files ```git restore file``` → Discards unsaved changes in a file --- 🌿 BRANCHES ```git branch name``` → Creates a new branch ```git checkout -b name``` → Creates and switches to a new branch in one step ```git merge branch``` → Merges the specified branch into the current one ```git branch -d name``` → Deletes an already merged branch --- ☁️ REMOTE (GITHUB) ```git remote add origin url``` → Connects your local repository to GitHub ```git push origin main``` → Pushes your commits to the main branch on the remote ```git pull origin main``` → Downloads and integrates remote changes ```git fetch``` → Downloads remote changes without integrating them yet --- 💡 RECOMMENDED BASIC WORKFLOW git add . → git commit -m "feat: description" → git push origin main Use branches for every new feature and open a Pull Request on GitHub before merging into main.