Skip to content

Instantly share code, notes, and snippets.

@justin-lyon
Created May 16, 2018 12:21
Show Gist options
  • Save justin-lyon/c9edcd612213aa7bfaf5cdc32ec34efa to your computer and use it in GitHub Desktop.
Save justin-lyon/c9edcd612213aa7bfaf5cdc32ec34efa to your computer and use it in GitHub Desktop.
Justin's git cheatsheet

Sum [dev] branch revisions into a single merge commit on [target] branch (Like Pull Request)

git checkout [target]
git pull
git merge [dev] --no-ff -m "message"
git push

Cherry Pick

// One commit
git checkout [targetBranch] 
git cherry-pick <srcCommitHash>
// squash range of commits
git checkout [targetBranch]

// two separate commits
git cherry-pick -n <srcCommitHash1> <srcCommitHash2>
// or a range from commit 1 to commit 3
git cherry-pick -n <srcCommitHash1>..<srcCommitHash3>

git add .
git commit -m "message"
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment