Reputation: 2663
We are looking for a strategy to pull latest changes from master to a development branch which has commits which are already pushed.
Often developers in my team want the lastest changes from master into their development branch. The development branch has new commits which are already pushed to the remote.
Rebasing is not an option because, that changes the commit ids and the commits can no longer be pushed to remote.
I am not sure if we can merge master to the development branch.
So, I am suggesting developers to create a new branch from master, cherry pick their changes from the previous development branch into the new one and discard/delete the old development branch.
Can anyone please suggest the right approach? Is merging master to a development branch a good idea? Won't it create duplicate commits?
Another idea that comes to my mind is to delete the remote development branch, rebase the local branch and push the branch again. But this will cause problems for other developers while pulling.
Upvotes: 0
Views: 83
Reputation: 31
To pull latest commits from the master branch (pushed to remote origin), in the development branch, you can merge the changes from master to the dev branch
$ git checkout dev-branch
$ git merge master
Instead of pushing directly to the master branch, you can have a staging
branch, which will be pushed to, then create pull requests to update the master
branch from staging.
Then you can then checkout from staging git checkout stagging && git checkout -b new-feature-branch
make updates, push to staging git push origin staging
Upvotes: 3