How do I find the list of changes present in one repo, but not merged into another?

Viewed 36

I have a couple of git repos.
One is used for development of specific features (say xyz), while one is the mainline (say main).

We periodically pull(sometimes cherrypick as well) changes to main from xyz.

I am looking for a command that shows me a log (git log like output) of the changes present in xyz, but not in main

I tried to look for a command, but couldnt find one.

1 Answers

I will assume that by 'main' or 'xyz' you are talking about branches inside the same repository.

You can start with git log --oneline --no-merges ^main xyz but that would list cherry-pick commits.

You can also launch an interactive rebase, which will list all commits from xyz to base on top of main: any cherry-picked commits will not be listed.

git switch xyz
git rebase -i main

You can then abort the interactive rebase session from the editor.

If those are not from the same repository, but still have a common history (meaning one repo was done from the other), the same idea apply

cd /path/to/repo/xyz
git switch xyz
git remote add repomain /url/repo/main
git fetch repomain
git rebase -i repomain/main
Related