将 git-svn master 分支重新指向主干
我不确定我是如何进入这种状态的,但我本地 git-svn 存储库上的 master
分支似乎指向远程 UAT 分支。
git status
# On branch master nothing to commit (working directory clean)
git svn dcommit Committing to https://svn...com/MyRepo/branches/UAT ...
我该如何解决这个问题?
I'm not sure how I got into this state, but my master
branch on my local git-svn repo seems to be pointing to the remote UAT branch.
git status
# On branch master nothing to commit (working directory clean)
git svn dcommit Committing to https://svn...com/MyRepo/branches/UAT ...
how do I fix this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为您要解决的问题是您的本地“主”分支基于远程 UAC 分支,而不是远程主干。如果您很高兴失去提交,您可以简单地运行下面的命令,这将检查主干,然后将主分支移动到您当前的位置。
如果您不想丢失提交,
git rebase
是您的朋友。使用以下命令:这会计算出 UAC 分支和本地 master 分支的共同父级,将所有从那里到 master 分支顶端的提交提交到主干上,然后将 master 分支移动到那里。
I think what you're trying to fix is that your local "master" branch is based on the remote UAC branch, as opposed to the remote trunk. If you're happy to lose your commits, you can simply run the below, which will checkout the trunk and then move the master branch to your current point.
If you don't want to lose your commits,
git rebase
is your friend. Use the below:This works out the common parent of the UAC branch and the local master branch, makes all the commits from there to the tip of the master branch onto the trunk, then moves the master branch to point there.
一种方法是重命名当前主分支并将 origin/trunk 签出为(新)主分支。
如果您需要,您现在可以将cherry-pic从uac分支提交到master(我会使用
gitk --all
来帮助我解决这个问题)一个更复杂的问题:
重命名本地和远程 Git 存储库的 master 分支
One way would be to rename the current master branch and to checkout origin/trunk as (new) master branch.
If you need you can now cherry-pic commits from the uac branch to master (I would use
gitk --all
to help me with this)A little more complex problem:
Rename master branch for both local and remote Git repositories