How to Merge Development and Production Branches in Git
Suppose I have a
development branch and
production branch in a Git repository.
I’ve switched over to my
development branch, made changes, and now want to merge my changes into the
# Switch to development branch git checkout development # Add files after making changes git add . # Commit files git commit -m "commit message" # Push changes to the remote git push origin development
Now we want to merge this branch into the
# Switch to production branch git checkout production # Merge changes from the development branch git merge development # Push changes to the remote git push origin production # Switch to development branch again git checkout development
At this point, assuming that there is a production server hosting code from the
production branch, we can pull the changes from this production server.