Work with Git

Here’s the step-by-step guide to creating a new branch, working on it, and merging it back into main:

Make changes to files

git add .
git commit -m “Commit message”
git push origin my-feature-branch # Push to remote (optional)

git checkout main # Switch back to main
git pull origin main # Get latest changes
git merge my-feature-branch # Merge changes
git push origin main # Push to remote
git branch -d my-feature-branch # Delete local branch (optional)
git push origin –delete my-feature-branch # Delete remote branch (optional)

Similar Posts

Leave a Reply

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