DEV Community

Cover image for Merge the Current Branch to Main and Push to GitHub
Eva
Eva

Posted on

Merge the Current Branch to Main and Push to GitHub

| objective |

Merging the current branch to main at the end of a successful dev session is a professional "best practice." It ensures your "production" code is up to date and earns you that well-deserved, sweet, green square on your GitHub contribution graph.

| how-to |

  1. Commit your current work to your branch:

git add .
git commit -m "feat: whatever you did with the branch"

  1. Switch to the main branch:

git checkout main

  1. Merge your feature branch into main:

git merge whatever your branch name is

  1. Push the main branch to GitHub:

git push origin main

Top comments (0)