git checkout -b name_of_branch
git com -m "message"
git push origin name_of_branch
You do this to prepare to a pull request. Usually I’ve just
git pull origin master and do a merge commit, but this leaves the history a bit cleaner. It basically reverts to the branch point, pulls from master, then reapplies the changesets in the branch.
So instead of: a b |\ branch | c | d e | || | f merge commit g/ pull request
You get: a b e |\ branch | c | d g/ pull commit
git pull --rebase origin master
git mergetoolor similar, then
git rebase --continueand repeat until everything is applied. The branch name should go yellow if using PoshGit. Some of those merges can be brutal.
The push needs to be ‘forced’ to overwrite the exising branch (since it has been updated - rebased). So you NEVER do to the
master branch as it rewrites history.
`git push -f origin name_of_branch
The feature branch should now be ok to create a pull request or merge to master.