Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git how to find out which single commits that done on one branch and not another

Tags:

git

diff

I am about to create a patch file for a project. My branch is the "master" in my local repository. And the remote upstream branch is mapped to the local branch "origin". \ With this command I can compare the two branches and see all differences

git diff origin..master

[gives me a full patch format of all commits]

But in this case, I'd like to cherry-pick some of the commits and create a new patch file specificly for the different areas wheere my branch differs. The question is how I can see the individual commits?

like image 345
Jesper Rønn-Jensen Avatar asked Nov 17 '25 20:11

Jesper Rønn-Jensen


1 Answers

To just see the commits you can use

git log origin..master

You can also add the -p option to see the individual patches. If you want to cherry pick commits you can use the git rebase -i option which is pretty neat.

On your master branch:
git checkout -b create-patch-foo
git rebase -i origin

This will let you pick, edit, omit or even squash (combine) commits.

like image 52
hallski Avatar answered Nov 20 '25 13:11

hallski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!