Important Git commands to remember

By | December 18, 2022

–help is your friend after git + <your_command>

Step 1: Check your branch

git branch

Step 1a: If you need to create a branch

git branch dev

Step 1b: If you need to delete a branch

git branch -d dev

Others to keep in mind

git branch -D dev
git branch -m dev2
git branch -a

Step 2: Checking your remote

git remote

NB: add -v for verbose

Step 3: Staging your changes

git add .

Step 3a: Un-staging your changes

git reset

Step 4: Committing your changes

git commit -m "My first commit"

Step 5: Push your changes

git push origin main


The -u flat allows you to set the default remote branch for your current local branch. By default, every pull command sets the master as your default remote branch.

Category: Git

Leave a Reply

Your email address will not be published. Required fields are marked *