Tag: Git

Git – move accidental commits to a different branch

If you’ve been working on a common staging branch when you thought you were working on a personal feature branch, you can move your work by doing the following: git checkout feature_branch git cherry-pick SHA (Do this for each commit on the mistaken branch) git checkout staging git reset –hard HEAD~n (where n = the […]

Git – list commits in topic branch that are not within the master branch

git log topic ^master –no-merges This will list all commits within the topic branch that are not found within the master branch. I needed this to cherry-pick specific commits out of a working feature branch when I mistakenly rebased against a common staging branch.