Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Commit->Push->Push Upstream-> Argh!!!
Commit->Push->Push Upstream-> Argh!!! [message #997460] Mon, 07 January 2013 15:54 Go to next message
Dennis Putnam is currently offline Dennis Putnam
Messages: 52
Registered: January 2012
Member
I guess I am still not understanding all the pieces involved. I have a remote repository (bare) on a Linux server. I cloned that to create a local repository on Windows and Eclipse recognized it as a project. In the Java perspective I was able to make changes and commit them. I thought I was golden. I also pushed them upstream and while there were no error popups it seemed to happen suspiciously fast and there was no window showing the session (I thought there would be one). In any case, I then did a pull from the Linux repository into my build directory on Linux and the git output seemed to indicate that the files pulled where the same ones I changed. However, when I look at the files that were pulled, they are the old version. It would appear that the changes never really made it to the remote repository. If I try to amend the previous commit, Egit tells me it has already been published to a remote branch. All indications seem to be that the upstream push worked but yet I cannot find the modified files (where does a bare repository hide the files anyway?). What am I missing? TIA.
Re: Commit->Push->Push Upstream-> Argh!!! [message #997471 is a reply to message #997460] Mon, 07 January 2013 16:39 Go to previous messageGo to next message
Dennis Putnam is currently offline Dennis Putnam
Messages: 52
Registered: January 2012
Member
After a little more research, I decided to try 'git fetch' followed by 'git reset --hard origin/master'. That seemed to work but I don't really understand why I needed to do that. Is 'git pull' simply the wrong way to update my build directory? No changes are ever made since this is just for builds so I don't have to worry about losing commits but I need to understand how to keep this directory current. I know this is really no longer an Egit issue but hopefully someone here can answer without me re-posting everything on another forum. TIA.

[Updated on: Mon, 07 January 2013 16:40]

Report message to a moderator

Re: Commit->Push->Push Upstream-> Argh!!! [message #997476 is a reply to message #997471] Mon, 07 January 2013 17:23 Go to previous messageGo to next message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
Sounds like your clone isn't configured correctly for push, at least on whatever branch you were working on at the time. You need to tell Git how local and remote branches are related to another for push and fetch. Or else you need to tell it dynamically, on each call, by providing ref-spec (Git term for pattern that describes a local -> remote branch mapping) or the EGit equivalent of a ref-spec.

Some of the configuration happens automatically, some doesn't. You can modify the relevant configuration settings via Team -> Remote -> Configure Push to Upstream.

My guess is that the push was a no-op due to misconfiguration, but that EGit still noted the the commits as pushed and therefore no longer amendable [possible EGit bug here]

To figure out more definitely what went wrong we would to know what local branch you were working on and what your local configuration looks like. The latter it stored in .git/config in your clone. You can get a structured list via 'git config --local -l'. In Egit you can also see the logical structure in the "Properties" view of the Git repository.

Most of this is generic Git -- you can find out more about ref-specs and branch mapping in the usual Git reference resources.


Quote:
where does a bare repository hide the files anyway?


The bare remote does not store user files anywhere, it stores commits, organized as directed graph to model branching and merging. That's what makes it 'bare' -- there is no working tree and no index. The commit graph is what you're cloning when you do a 'git clone', and the push and fetch operations are moving commits back and forth, not working files.



Re: Commit->Push->Push Upstream-> Argh!!! [message #997484 is a reply to message #997476] Mon, 07 January 2013 18:09 Go to previous messageGo to next message
Dennis Putnam is currently offline Dennis Putnam
Messages: 52
Registered: January 2012
Member
This is getting more confusing all the time. If the bare repository is not storing any source, then where does the source come from when a clone of the remote repository is done?
Re: Commit->Push->Push Upstream-> Argh!!! [message #997497 is a reply to message #997484] Mon, 07 January 2013 19:44 Go to previous messageGo to next message
R Shapiro is currently offline R Shapiro
Messages: 386
Registered: June 2011
Senior Member
The source files are implicit in the commits.

In a non-bare repository the working tree of files and directories are created, deleted or updated on 'checkout', based on the state of the branch being checked out. The usual mantra is that a Git commit saves the state of the working files in a kind of virtual file-system, as opposed to version-control systems like SVN in which a commit saves diffs. I don't know how this works internally, and so far my impression is that you don't need to know the internal details at this level to use Git effectively. But I imagine it's all documented somewhere if you're curious. If nothing else you can get the C++ Git sources from here:

https://github.com/git/git.git

The primary job of the clone operation is to copy all the current commits to the newly created clone. It has nothing to do with working files directly. But it typically also has the side-effect of checking out a branch (eg "master"). That checkout is how you get the initial working tree after a clone.
Re: Commit->Push->Push Upstream-> Argh!!! [message #997498 is a reply to message #997497] Mon, 07 January 2013 19:53 Go to previous messageGo to next message
Dennis Putnam is currently offline Dennis Putnam
Messages: 52
Registered: January 2012
Member
Thanks for the explanation. So the source is in the bare repository but in some pseudo form. I don't really want to know the details but I just wanted to understand what seems like magic when files are pulled or fetched from the repository.
Re: Commit->Push->Push Upstream-> Argh!!! [message #998375 is a reply to message #997498] Wed, 09 January 2013 22:02 Go to previous message
Matthias Sohn is currently offline Matthias Sohn
Messages: 580
Registered: July 2009
Senior Member
A bare git repository stores the commits and there relationships in git's object database stored in
a folder usually called
<repository name>.git
e.g.
foo.git


When you clone a bare repository to a non-bare repository this object database gets copied over to
your machine into a folder
<repository name>/.git
e.g.
 foo/.git

Subsequently a local branch with the same name as the default branch on the remote repository
(defined by HEAD on the remote bare repository, most often this is "master") is created pointing at
the commit the default branch references and then this branch is checked out to your local file system
into the folder above the .git folder, for our example this is the folder
foo/

In git jargon this is often called the working tree.
Previous Topic:credentials not passed
Next Topic:Flash Builder 4.7, eGit and the 'Label Decorations'
Goto Forum:
  


Current Time: Tue Sep 23 12:35:26 GMT 2014

Powered by FUDForum. Page generated in 0.04175 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software