1. Having two branches, branch1 and branch2, to know which commits are in branch1 but not in branch2 :
git checkout branch1
git cherry -v branch2
the output will be something like :
+ 2dcf5fec8c4f7ff474512b85378d8a0347f5850d commit message
+ 90f55270f9796038d7bc35938890469f34fe0091 commit message
git commit -p file
git branch --set-upstream-to origin/master existingbranch
For instance :
$ git checkout -b localbranch
$ git branch -vv
...
* localbranch d5a2069 docs(tutorial): fix typo in module name
...
$ git branch --set-upstream-to origin/master localbranch
$ git branch -vv
...
* localbranch d5a2069 [origin/master] docs(tutorial): fix typo in module name
...
$ git commit --amend --no-edit
$ git checkout HEAD <filename>