Reputation: 891
This is what I want to do:
This is what I see:
Let me give an example and maybe someone can tell me where I have gone wrong.
C:\GIT\remote
which contains a file called readme.txt
which contains the string Hello World!
I turn this into a Git repository, I stage the readme.txt
file, it shows:
new file mode 100644
@@ -0,0 +1 @@
+Hello World!
I commit this change at the remote repository. The remote repository contains no unstaged changes
Start Eclipse, import->Projects from Git->Clone URI
. Location URI = C:\GIT\remote
, Next
, Next
, Destination Directory: C:\GIT\local
, Next
, Import as General Project
, Next
, Finish
This creates a git repository in C:\GIT\local
, with the readme.txt
file and a .project file. As expected.
In Eclipse, I open the readme.txt
file and edit it to say Goodbye World!
. Save.
Right click on project in Project Explorer and: Team->Commit
Files to change are: readme.txt
and .project
. I enter a commit message "made changes" and click Commit
.
Eclipse now shows that the local repository is 1 commit ahead of the remote repository. (Am I right?)
Team->Push to Upstream
and it shows my comment and the remote repository details:
It's showing that the .project
file needs to be removed (instead of being added), and that the change to the readme.txt
file should be the reverse of the change I just made:
@@ -1 +1 @@
-Goodbye World!
+Hello World!
The C:\GIT\remote\readme.txt
file contains the string "Hello World!". The staged patch doesn't even make sense according to the contents of the file.
I am puzzled.
Upvotes: 1
Views: 61
Reputation: 33063
No, those are the staged changes on remote. Not the commit history (the git log). Those are two different things.
The "Git GUI" is showing you the changes that you would need to commit directly to the remote repository to bring it into sync with the remote repository's working directory, which is still in the old state - out of date.
To avoid this confusion, developers often make the remote repository a bare repository - one with no working directory. Then it can only be pushed to and pulled from - not committed to directly.
Upvotes: 2