简体   繁体   中英

Merging remote git repo into a local repo and pushing the result back to remote

I have read several guides on how to achieve this.

I have a local set of files in git repo under master/ branch. I added a remote branch for the remote I want to pull down.

I then ran git fetch other to pull it into a local branch called other .

I then ran git checkout -b zzz other/master

But I keep getting error

The following untracked working tree files would be overwritten by checkout
errors.

And I cannot get any further. Could do with some help of the best way to achieve this.

You have locally created files in your working tree that are not committed to any branch (and, in particular, are not included in the branch you are switching away from, so they are truly currently untracked), but the branch you are switching to includes files with the same names (not necessarily guaranteed to be the same or even related content, though). git is saying it can't properly check out the new branch without overwriting something that it sees is not preserved elsewhere.

Move those files somewhere else, then do the git checkout , then compare the versions of those files that are in the branch with your copies to see what you need to do with them.

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