简体   繁体   中英

How to bring commits form another repository branch

So I want to bring only commits from another repository branch to my local branch. How can I do that or can i do that using cherry-pick?

So i tried merging two branches but it brought unrelated histories as well

If you only want to have certain commits on your branch from another branch, then git cherry-pick is the way to go. This will pick the changes onto your branch, but be aware, that this will create a "new commit" (with the same source changes, but with different meta data like a different commit hash). So if you want to merge these two branches later, it will be show twice in your history.

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