Git: merge only the changes made on the branch

This article advises to instead of merging two branches, you would rebase them where git would only rebase non duplicate commits. But instead of cherry-picking, you might consider just rebasing the branch: rebase –onto release B bug where release is the release branch and bug is the bug branch. You then get something like C’—D’ … Read more

Freezing a Git branch

Christopher is right, tagging will help you do this. I recommend deleting the branch name too to make it a little harder for someone to checkout the branch and make edits. First, merge the branch into develop git checkout develop git merge –no-ff feature_1 Then checkout the branch git checkout feature_1 Then create a tag, … Read more

Sync all branches with git

I think you want to: git fetch –all -Pp where: git fetch Download objects and refs from another (remote) repository –all fetch all remotes. -P remove any remote-tracking references that no longer exist on the remote. -p remove any local tags that no longer exist on the remote. for more use git fetch –help We … Read more

git branch -M main

Update: The -m and -M options to git branch were upgrade in Git 2.30 to allow renaming the not-yet-existing current branch name in special situations, such as when you’re in a new, empty repository. You mention in your own answer that git branch -m main (or the same with -M) only works once you have … Read more