如何使用 Eclipse EGit 从我的服务器 git 存储库下载/克隆新分支到我的 PC 中已创建的本地 git 存储库
这让我发疯。
我在我的托管公司托管的 Linux 服务器中创建了一个 git 存储库。
我使用 Eclipse EGit 将其克隆到本地副本。
然后我在服务器的原始 git 存储库中创建了一个分支。
如何使用 Eclipse EGit 将分支复制到本地副本?
当我在 EGit 中打开 Git 存储库时,我看到:
- Local
-- master
- Remote Tracking
-- origin/development
-- origin/master
How can I get the origin/development in my local using EGit?
我知道我可以创建一个新的克隆,但我不想这样做,因为我相信必须有一种方法只能获取新的分支。
第二个问题 - EGit 中的 pull 命令在哪里?我能够找到 fetch 命令,但当我运行它时,它说没有任何内容可获取。 RefSpec 是:
+refs/heads/*:refs/remotes/origin/*
第三个问题 - 有没有办法在我的 Windows 系统中从 Eclipse 内的命令行处理 git 命令?我想过尝试从命令行进行拉取,但我在本地系统中找不到它。
谢谢。
This is driving me crazy.
I created a git repository in a Linux server hosted by my hosting company.
I cloned it to a local copy using Eclipse EGit.
I then created a branch in the original git repository in the server.
How do I copy the branch to my local copy using Eclipse EGit?
When I open Git Repositories inside EGit I see:
- Local
-- master
- Remote Tracking
-- origin/development
-- origin/master
How can I get the origin/development in my local using EGit?
I know I could create a new clone, but I don't want to do that as I believe there must be a way to get only the new branch.
Second question - where is the pull command inside EGit? I was able to find the fetch command, but when I run it it says that there is nothing to fetch. The RefSpec is:
+refs/heads/*:refs/remotes/origin/*
Third question - is there a way to process git commands from a command line inside Eclipse in my Windows system? I thought about trying to do a pull from a command line, but I can't find it in my local system.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我还搜索了大约几个小时,以了解如何在 Eclipse EGit 中获取远程分支...
解决方案在 此错误报告。如果你知道怎么做的话,这真的很容易 - 不需要使用 git 的命令行版本,尽管它在 99% 的情况下都可以工作 - 可能会有风险,因为我已经遇到了它干扰 Eclipse 的问题和 Egit。
只需按照以下步骤操作:
存储库视图
。如果您还没有打开它,请转到“Window → Show View → Other...”,然后选择“Git → Git Repositories”。存储库视图
中选择“分支→远程跟踪”。您应该已经在那里看到您的远程分支(例如:origin/new_feature
)。I've also been searching around some hours to find out how to get a remote branch in Eclipse EGit...
The solution is stated in this Bugreport. And it is really easy if you know how to do it - no need for using the command line version of git, which - even though it works in 99% of all cases - can be risky as I already had problems that it interfered with Eclipse and EGit.
Just follow these steps:
Repository view
. If you haven't opened it already, go to "Window → Show View → Other..." and from there select "Git → Git Repositories".Repository view
choose "Branches → Remote Tracking". You should see your remote branches there already (example:origin/new_feature
).您的获取是最新的,因为您已经将所有内容复制到本地存储库。拉取会将
origin/development
合并到 master 中,这不是您想要的。您想要创建一个以origin/development
作为起点的新分支。我不知道如何使用 egit 执行此操作,但在命令行上,您可以:Your fetch is up to date because you already have everything copied to your local repository. A pull will merge
origin/development
into master, which isn't what you want. You want to create a new branch withorigin/development
as the starting point. I don't know how to do it with egit, but on the command line, you do:我也遇到了同样的问题,这是我解决它的方法:
打开 Git 透视图
首先,您必须在存储库中
下拥有要签出的分支em>远程跟踪。我的问题是我在这里看不到远程分支,所以为了解决这个问题 - 在存储库上执行Pull,并且此命令应该为您提供远程跟踪下的所有分支
I have been facing the same problem, and here is how I solved it:
Open Git Perspective
First you must have the branch that you want to check out, in your repository under Remote Tracking. My problem was that I couldn't see the remote branch here, so in order to solve this - execute a Pull on the repository, and this command should get you all the branches under Remote Tracking
要获取 sts 中的其他分支,如果 pull 不起作用,请尝试此操作
团队>>远程>>配置从上游流获取>高级>
在源参考中检查您想要的分支:>然后添加规格
To get other branches in sts , if pull didn't work then try this
Team >> Remote>> Cofigure fetch from upstream stream>Advanced>
Check branch you want in source ref: > then add spec