简体   繁体   English

如何在eclipse中使用egit同步master和origin / master?

[英]How do I synchronize master and origin/master using egit in eclipse?

I created a local git repository, and I push changes from it to a gitosis remote that I created with 我创建了一个本地git存储库,并将其中的更改推送到我创建的gitosis远程

git init my_git
git remote add origin git@server:my_git
... various adds and commits
git push origin master:refs/heads/master

Now, I edit and commit changes locally in eclipse, and when I commit, I see (using qgit) that it moves my master branch to that version. 现在,我在eclipse中本地编辑和提交更改,当我提交时,我看到(使用qgit)它将我的master分支移动到该版本。

However, it also shows me that origin/master is at the previous version. 但是,它还向我显示origin/master是以前的版本。

git status on command line shows me everything is up to date: 命令行上的git status显示一切都是最新的:

$ git status
# On branch master
nothing to commit (working directory clean)

I can see the differences in versions with 我可以看到版本的差异

git diff origin/master

If i do git push on my command line, then qgit shows me the origin/master branch is now at same place as my master . 如果我在我的命令行上执行git push ,那么qgit会告诉我origin/master分支现在和我的master

I can't work out how to configure the "remote / push" or "remote / configure push to upstream" dialog in eclipse to do the same thing as a command line git push to move the origin/master to the same level as the master . 我无法弄清楚如何在eclipse中配置“远程/推送”或“远程/配置推送到上游”对话框,以执行与命令行git push ,将origin/master移动到与master

I always have to do the command line push to make the origin/master come up to the same place as master . 我总是要做命令行推送,使origin/master到达与master相同的地方。

Q1. Q1。 Can anyone tell me how to do this in eclipse? 任何人都可以告诉我如何在日食中做到这一点?

Q2. Q2。 What is the command line version of git push doing that the eclipse version doesn't do? 什么是git push的命令行版本,eclipse版本没有这样做?

Q3. Q3。 Are my assumptions that master is my local HEAD pointer and origin/master is the remote server's view of the current HEAD correct? 我的假设是master是我的本地HEAD指针而origin/master是远程服务器对当前HEAD的正确视图吗?

Going by the relevant part of egit's documentation you can either: 按照egit文档的相关部分,您可以:

  • click the "Add all branches spec" button, to push all of your local branches to ones with the same name in the remote repository, or 单击“添加所有分支规范”按钮,将所有本地分支推送到远程存储库中具有相同名称的分支,或
  • (the much safer option) just select master under both "Source ref" and "Destination ref" to only push your master branch (更安全的选项)只需在“Source ref”和“Destination ref”下选择master ,只推送你的master分支

The remote-tracking branch origin/master is usually updated by git fetch (which is part of what git pull does), but with command line git, the remote-tracking branch is also updated on a successful push to the branch in the remote repository that's being tracked. 远程跟踪分支origin/master通常由git fetch更新(这是git pull所做的一部分),但是使用命令行git,远程跟踪分支也会在成功推送到远程存储库中的分支时更新正在跟踪。 It's possible that Egit, being based one of the pure Java implementations of git, JGit , rather than the command-line tools, doesn't update origin/master on a successful push in the same way. Egit可能是基于git的纯Java实现之一, JGit而不是命令行工具,它不会以相同的方式在成功推送时更新origin/master If that's the case, you can just do a fetch to update origin/master . 如果是这种情况,您只需执行提取即可更新origin/master


Update : It seems that this is a known bug in EGit (not the underlying JGit) - the bug report is here: 更新 :似乎这是EGit中的一个已知错误(不是底层的JGit) - 错误报告在这里:

对此进行了更新,我使用的是eclipse Helios,并且已经使用最新版本的egit升级到Indigo,并且修复似乎是活动的,因为我不再需要在推动后拉动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eclipse EGit Automerge致力于掌握其他分支 - Eclipse EGit Automerge commits to master to other branches Eclipse Git(EGit)-在与本地分支进行错误合并和提交之后,如何将本地主服务器恢复为远程主服务器 - Eclipse Git (EGit) - How to revert local master back to remote master after a foul merge & commit with a local branch 相当于“ git push -f origin master:staging”的Egit - Egit equivalent of “git push -f origin master:staging” Eclipse egit:如何与远程仓库同步? - Eclipse egit : How to synchronize with remote repo? 如何在Egit中将当前分支更改为master? - How to change the current branch to master in Egit? 如何将代码从eGit的主服务器中提取到Eclipse IDE中的本地分支? - How to pull code from the master in eGit to my local branch in eclipse IDE? Eclipse Egit:更新一个github fork来合并master repo的更改? - Eclipse Egit: Update a github fork to merge changes of master repo? 如何使用Git,Eclipse和Egit进行合并 - How do you do merges using Git, Eclipse and Egit 如何在Windows的Eclipse上使用egit切换到新的本地git存储库 - How do I switch to a new local git repository using egit on Eclipse for Windows Egit:如何将Eclipse项目(本地存储库)与远程存储库同步 - Egit: how to synchronize eclipse project ( local repository) with the remote repository
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM