Some tips of Git branching
-
Creating a local branch
git branch <target branch> <source branch>
Create a local branch and switch to that branch:
git checkout -b <target branch> <source branch>
If<source branch>
is omitted then it’ll branch from the current branch.
It can be a problem if we branch from X branch, push then create pull request to merge into Y branch. -
We don’t need to have an exsiting remote branch for the push, otherwise we’ll have to pull and merge locally first.
-
Creating pull request after pushing may cause merge conflict, which happens after code review approval in Azure DevOps.
-
Deleting a local branch with
git branch -D <branch name>