Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.0k views
in Technique[技术] by (71.8m points)

git checkout - Git with multiple remotes: first_remote/second_remote/master created instead of checking out second_remote/master

New poster to Stack Overflow--thanks for your patience.

I have two remotes, each with its own copy of a repo, my_repo; one is called dev and one is called stage. I am trying to merge a branch new_branch from stage into stage/master, but I'm running into trouble checking out stage/master.

Using VS Code's source control, I checked out a branch called stage/master, resolved some merge conflicts, and then tried to push my merge commit. However, I got an error, Git: fatal: Couldn't find remote ref stage-update/master. Git fetch and git fetch stage also returned errors.

To be sure I was in the correct branch, I tried git checkout stage/master, but got the error:

warning: refname 'stage/master' is ambiguous
Already on 'stage/master'
Your branch is ahead of 'dev/stage/master' by 14 commits

So it looks like at some point, I must have created a branch dev/stage/master... but I don't see it on Gitlab, can't push to it, and can't delete it.

I also tried git checkout master stage/master, but that gives me the error error: pathspec 'stage/master' did not match any file(s) known to git..

Any suggestions on how I can:

  1. Check out stage/master so that I can merge stage/new_branch into it, and
  2. Delete dev/stage/master, which shouldn't exist

Thanks all, appreciate any advice on this.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神解答

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...