git branch - weakish/cheat GitHub Wiki
Git branch
Create and switch to a new branch:
git checkout -b new
Switch to an existing branch:
git checkout branch-name
Show branches:
git branch
Pulling with rebase:
git pull --rebase
Merge into master (after rebase):
git rebase master new
git checkout master
git merge --no-ff new #ensure fast-forward for clean history
At last delete the branch safely. git
will refuse to delete it if unmerged:
git branch -d new #
For multiple branches, check git help rebase
for --onto
option.
git rebase
will abort on conflicts and leave conflict markers in files.
After manually resolve the conflict, tell git via git add filename
, and
git rebase --continue