简体   繁体   中英

merging two git repos

I did search all the questions that are similar to mine but still, I am not able to achieve what I wanted to. Please advice if this is possible:

  1. I have publicRepo/master branch
  2. I have privateRepo/master branch

I would like to simply take the latest of publicRepo/master and merge with privateRepo/master. But I would like to take everything from publicRepo/master regardless of merge conflicts (similar to what used to be git pull -s theirs)

How can this be done, so far I have tried these solutions:

1) Merge 2 Different git Repos (I end up with 3 way merge and get theirs when there are conflicts) 2) Merging two Git repositories

I also tried:

git fetch --all (as I added publicRepo/dev as one of my remotes)

git reset --hard publicRepo/dev

git pull (does a 3 way merge, which I do not want, I want everything from my publicRepo/Master)

You can try using git fetch upstream after making the publicRepo as upstream.

  1. Add the remote of public repo:

    git remote add upstream {publicRepo}

  2. Fetch the latest data from upstream public repo, while checkout out in your private repo:

    git fetch upstream

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