'Is it necessary for dev branch and main branch up to date?

I am confused about some concepts in Git.

I try to use GitHub for my codes.

I have a branch main and I treat it as my deployable branch.

Then, I create a dev branch from the main branch for my development.

My workflow is whenever there are new changes, I will add to dev and test it.

If everything is alright, I will merge it to 'main' for deployment.

So, I add some changes to dev and make a pull request merging it to main.

However, I notice the dev branch is 1 commit behind main after merging. I can see main contains one extra commit from the merge pull request.

My Questions:

Should I make dev branch always up to date regarding to main and why? If so, how can I do it?

git


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source