Merging Pull Requests via Git CLI

MD
R
Markdown

Simple recipe to manage (merge) pull requests from remote feature branches via terminal (Git CLI). Further reading: https://git-scm.com/book/en/v2/Git-Branching-Basic-Branching-and-Merging

Quick way

git fetch origin git checkout -b fix/credit-transaction-callback origin/fix/credit-transaction-callback git merge production git diff origin/production

git checkout production git merge --no-ff fix/credit-transaction-callback git push origin production

Longer Way

List all feature branches from remote

git fetch origin git remote show origin

Copy the feature branch to local

git checkout -b feature origin/feature git remote show origin git log --graph git merge master

Merge changes from feature into master

Using a no fast-forward strategy to keep a full history of feature branches. git checkout master git merge --no-ff feature git push origin master git reflog

Remove feature branch

git branch -d feature

Created on 9/16/2017