[solved] check in/out problem [message #750389] |
Tue, 25 October 2011 19:21 |
Bit2_Gosu Messages: 6 Registered: October 2011 |
Junior Member |
|
|
Hi,
Today is my first day with egit I have a remote repository at "google code". I had a local project which i pushed to the remote rep.
I then deleted the local project and used "file -> import -> projects from git" to pull the project from the remote rep. For this i cloned the remote project.
I now have a local project with "[name of the remote rep.]" behind it's name. I hope this local project is now "connected" with the remote one.
I now want to use synchronize to check out/in. However this doesn't quite work. In order to see remote changes i have to go to "synchronize -> git -> [name of remote rep.] as repository and the remote branch as destination -> finish.
Only then does the synchronize view see the remote change (blue arrow). And there are no black arrows if i change a file locally. I therefore have to push in order to get the local changes to the remote rep..
Somehow I seem to be doing things a little wrong. Can someone help?
[Updated on: Mon, 31 October 2011 18:47] Report message to a moderator
|
|
|
Re: check in/out problem [message #750501 is a reply to message #750389] |
Tue, 25 October 2011 20:29 |
|
If you want to synchronize with yours origin/default remote repository simply choose Team -> Synchronize Workspace from project's context menu.
If you change something in working directory (it mean in yours project shared by git) then such change should immediately snow in synchronization results (if synchronization for this repository was launched before change occurs). Of course changes will also appear in sync results when you launch synchronization process after save action. If you will use pull action then you'll never see any incoming changes in sync view, during pull process all incoming changes are immediately merged into current branch.
|
|
|
|
Re: check in/out problem [message #752016 is a reply to message #750627] |
Wed, 26 October 2011 08:39 |
|
Commit action affects only yours LOCAL repository (you must consider that using git you have local and remote repositories). To interact with remote repos use pull/push/fetch commands.
Fetch command will fetch remote changes into yours local repository. Remote changes are stored in refs/remote/$remote_name/$remote_branch_name (eg. refs/remote/origin/master for branch master from origin repository). To "check in" those remote changes you need to use merge/rebase commands not. commit (commit action is only used when you have some conflicts).
Pull command will fetch remote changes and automatically merge/rebase (depends on yours configuration) those remote changes into local branch.
Push action will send yours changes back to remote repository.
The git workflow looks something like this:
edit -> add to index -> commit locally -> push to remote
Git behaves different then cvs/svn eg. you cannot move right to left single change, you need to merge whole commit because commits are connected with each other. I would recommend you reading ProGit[1] book to better understood how git really works.
[1] http://progit.org/book/
|
|
|
Re: check in/out problem [message #753565 is a reply to message #752016] |
Thu, 27 October 2011 18:02 |
Bit2_Gosu Messages: 6 Registered: October 2011 |
Junior Member |
|
|
Hi again and thanks for your help so far,
I have now spent 1 day reading a lot about git. I could now push to remote by using "push to upstream". I configured my upstream as fetch/heads/* : fetch/heads/*. Push worked, so my local branch was now identical to the branch in the remote repos.
HOWEVER i still have a problem with fetching: I changed a file in the remote repos. I then said "fetch from upstream". I configured my upstream as refs/heads/* : refs/remotes/origin/*.
If I am correct, this means that all changes in the remote repos will replace my local stuff in my remote branch called origin.
Indeed he found the change that was made. I went to "advanced -> synchronize -> refs/remotes/origin/master". If I am correct this means that I want to synchronize my remote branch called master with the remote repos at github.com. Indeed he showed me a blue arrow and the change i made at github.com. If I am correct I should now attempt a merge which would be a fast-foward merge. I clicked merge. The blue arrow remained. I now clicked "add" and then "commit". After that both versions in the synchronize view where identical and my working space version, too. But in the synchronize view there is now a RED arrow. (I now can't push to upstream anymore - message: "rejected".)
What am I still doing wrong?
[Updated on: Thu, 27 October 2011 21:24] Report message to a moderator
|
|
|
Re: check in/out problem [message #753586 is a reply to message #753565] |
Thu, 27 October 2011 21:32 |
|
"refs/heads/* : refs/remotes/origin/*" means, fetch all remote branches to local ref/remotes/origin
"advanced -> synchronize -> refs/remotes/origin/master" means, compare my local working copy (or locally checked branch) with refs/remotes/origin/master
Honesty, I wouldn't recommend you use sync view to merge commits because effect of such action can be surprising for you. In most cases call 'merge' on single file will also affect rest 'incoming' files (since you need to merge-in all commit, not particular change in file). The only case when you need to use 'add' and 'commit' *while* merging is when you had some conflicts and you resolve them, in such situation by 'add' you inform git that all conflicts in particular file was resolved and 'commit' action indicates that all conflicts were resolved.
Currently sync view works for outgoing changes (you can commit them and then push to remote) and as review tool for incoming changes. We need to improve some thing to make synchronize view usable in both cases ... one of such thing is figuring out how to inform user that merging single file will affect all other files ...
|
|
|
|
|
|
Re: check in/out problem [message #754212 is a reply to message #754102] |
Tue, 01 November 2011 12:49 |
R Shapiro Messages: 386 Registered: June 2011 |
Senior Member |
|
|
In my experience there are two main reasons to use the Synchronization perspective in Subclipse. One is to review local changes before committing them, the other is to review incoming changes. For anything else it's more efficient to run the SVN operations from your primary development perspective (Java, C++, whatever). I've watched a number of developers switch to the Synchronization perspective just to do a blind svn update or commit, without any kind of review. I have no idea why they do this, I'm guessing they were taught to do it that way and never looked further.
To review before committing in egit, I strongly recommend the 'Git Staging' view.
To review incoming changes (ie, fetched or pulled) you can get at the incoming commits from the modal popup that appears when the egit operation completes, and open any given commit in its own window for more details. Might be nicer if this commit list weren't modal -- this was discussed in another thread. But it works ok as it is.
You should also ensure that the 'Git' command group is enabled in your primary perspective. This will give you menubar and/or toolbar support for all the fundamental operations: Add, Commit, Checkout, Rebase, Reset, Push, Pull, Fetch,
That doesn't leave much for the Synchronization perspective except branch/reference comparisons. In small repositories this works pretty well. For large ones, or any size repo with a very long history, it's pretty slow.
A feature I'd really like to see in egit is the equivalent of 'git log B1 ^B2', that is, a list of commits in one branch/reference but not another. This is generally a very fast operation on closely related branches and is extremely useful. If I could get the result as a view containing a list of commits, somewhat like the 'Git Reflog' view, that would be a huge win.
|
|
|
Powered by
FUDForum. Page generated in 0.04987 seconds