Git:如何更改远程存储库上的活动分支? [英] Git: how to change active branch on remote repository?

查看:172
本文介绍了Git:如何更改远程存储库上的活动分支?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在本地分支上工作了一些代码,然后用下面的命令将它推送到远程测试存储库:

  git push origin fix_vouchers:fix_vouchers 

我想更改远程存储库上的活动分支,其他开发人员可以测试此代码。我可以在我的本地环境中执行此操作吗?

解决方案

如果远程存储库只是一个共享点,只要将具有代码的分支传递给其他开发人员即可。

在稍后的评论中,您意味着远程存储库是作为网站的结账服务。您应该注意,即使您推送到当前活动的分支,推送也不会自动检出该分支的HEAD。



如果您没有任何shell访问远程机器,我不认为有可能做你想做的事情。如果你在那里有任何影响,你可以要求建立一个post-receive钩子来检查新的分支。



当然,如果你有ssh访问,

  ssh remote.netcd / path / to / repo; checkout fix_vouchers


I worked on some code on a local branch and then I pushed it to a remote test repository with this command:

git push origin fix_vouchers:fix_vouchers

I'd like to change the active brank on that remote repository so that the other developers can test this code. Can I do this from my local environment?

解决方案

If the remote repository is just a sharing point, a bare repository, you'd be better off just communicating the branch having the code to the other developers.

In a later comment you however imply that the remote repository is a checkout served as a website. You should note that even if you pushed to the currently active branch, pushing doesn't automatically check out the HEAD of that branch.

If you don't have any shell access to the remote machine, I don't think it's possible to do what you want. If you have any influence there, you could ask to set up a post-receive hook to check out the new branch.

Of course, if you have ssh access, just

ssh remote.net "cd /path/to/repo; checkout fix_vouchers"

这篇关于Git:如何更改远程存储库上的活动分支?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆