简体   繁体   中英

How to compare a forked branch with its original one?

Yet I've seen similar questions, git is still not easy to grasp, so here goes my version of main current problem.

I have the dev branch. Then I create my own dev branch with git checkout -b my_dev .

I work in this branch, while other developers are working on their own forked dev branches. Eventually the main dev branch is updated and I want to keep my_dev branch in sync with dev .

What is the best approach for that? Consider two scenários: with and without conflict.

It's important that I can see what's being changed upstream in dev when compared with mine. My first idea was to use git diff dev my_dev (and vice-versa) but, surprisingly, it only shows the files I've changed . It didn't showed nothing from upstream dev .

I did git fetch --all for sure too.

So far, the best I could get was using github and doing a pull request which nicely shows all the diffs and files that are in dev and not in my_dev . But I should be able to use only git cli , right?

You need to play with... (3 dots):

git diff origin/dev...my_dev # the stuff I have done
git diff my_dev...origin/dev # the stuff they have done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM