Extract PNG File from Eclipse Git Commit - eclipse

Several months ago, I committed some code and files to the local Git Repository in Eclipse IDE. I did not push the changes to the central Git Repository. Later, I deleted those files and committed those changes again to the local Git Repository in Eclipse IDE. Now, I need those files again. So, I open the Git Reflog tab in Eclipse IDE. I scrolled down to the commit and double-click on it. This opens another tab showing me the message I wrote, the files and the branches. Here's a screenshot of the files.
If I double-click on a text file, an editor opens with the contents of the file. This is exactly what I need. However, if I double-click on the png file, an editor opens which shows me the textual representation of the bytes in the file. This isn't what I need. How do I get the actual file?
In another commit, the only files in the commit were images. So, I Cherry Picked them back into my branch.

It turns out one can checkout a commit, copy the files to temporary location, checkout the local branch, and then copy the files from the temporary location back into the branch.
This answer explains how do to the checkout.

Related

Recovering a file in SVN

I deleted some files of a folder in SVN from eclipse. Now I want those files back to my folder. I can see the of the folder by clicking right click show history . how to get those files back into my workspace? Then I will commit to svn again
Thanks,
Raj
No idea how to do that in Eclipse but with plain Subversion that'd be
svn checkout
and
svn cat
commands: the former
allows you to check out the contents of all or specific
files and the specific revision (usually BASE),
and the latter
outputs the contents of the specified file
at the specified revition (again, usually BASE).
If you didn't delete it form remote folder you can simply recover it.
Synchronize the local workspace with remote repository and override the file that you deleted. It will override the local changes of the your file.

eclipse egit some files won't commit to github

I have a github repository and it is integrated into eclipse. I sometimes create files in other text editors, then refresh my project and then left click the project to get >Team>Commit. This usually gets every file. Unfortunately, I have several files that failed to commit this way. I don't see them on github and I can see the following when I do Team Synchronizing.
There is nothing I can do to get these files to commit to github. Can anyone see why? These is no error message or warning or anything. When I go to commit these files, they don't appear in the window that shows everything that needs to be commited (ie is new or has changes).
In Eclipse EGit, the preferred way to create commits is by using the Staging View. It shows a clear view of what files are staged and ready to commit and what changed files are not. It supports drag-and-drop to move files from un-staged to staged, as well as commit and commit+push directly in the view.
Open the Staging View and see if those files are in the Unstaged section. If so, drag them to Staged and then commit.

Start using Eclipse GIT with an existing project ... project files get moved

Yesterday I wanted to start using Eclipse eGIT on an existing project following the instructions on http://www.vogella.com/articles/EGit/article.html
This tutorial suggests to have the git repository outside of the workspace, and I followed this suggestion.
After the step "5.5. Using the Git Staging view for the initial commit" I committed my initial commit. Then I continued editing one of my source files that was still open. But when I tried to save my changes, Eclipse complained that the source file was no longer there.
Then I checked both my workspace and git folder, and the project files were only in git. This is mentioned nowhere in the tutorial. Is this normal behavior?
Even more surprising: In order to continue working normally with my already open files, I copied the project subfolder from .git back to the workspace folder. And now everything seems to be fine. My changes are reflected in workspace folder as well as in "Unstaged Changes" in the Git Staging view and in git folder.
Is this expected behavior?
I found out that the files really get moved. I needed to close all the open project files and then open them from package explorer again (which will open the files from git repository).

Github and Eclipse: not all files are commited

I´m using Github in Eclipse, and commiting my changes to it. I have added some files to my project, and I have clicked on Team->"Add to index" in each of them, for them to be commited when I make a commit of the whole project. However, these files are not added to be commited, and when I click in "Commit", they arent´shown in the list of modified files. How can I force them to be commited?
Thanks.
It sounds like you may be confusing the usage of Git wit SVN. In SVN when you add a file to be tracked, updates to the file will always be committed automatically.
In Git, when you add a file to the index, only the current version of that file is recorded. If you subsequently update the file and commit, the new updates won't be included. The solution is to do an "Add to index" on the root of your project right before you commit: the equivalent of git add . on the commandline. Make sure your .gitignore is set up correctly so you don't commit things you don't intend to.
An equivalent action is to do a git commit -a, which automatically adds all files previously in the index and updates any deleted files as well. I believe the equivalent setting in Eclipse (for eGit) would be to Include selected untracked files as in the commit settings below.

Mercurial will not recognize new folder in repository

I have an existing repo which has been setup correctly and working fine. I deleted an entire project folder from the repo, committed the change, then added another version of the same folder which was not under VC. Now when I try to add or commit files in the new folder, Mercurial does not seem to recognize any of the new files.
Using the TortoiseHg Windows Explorer "commit" extension, when I try to the commit the folder(or any of the files within), no files show up in the dialogue. If I right click and commit a file within the folder, a pop up comes up that says "No files found for this operation". I am no Hg expert, although I have been using it for few months without a hitch, but I am pretty stuck on this one. Any ideas?
UPDATE: I have added a screenshot below showing what happens when I try to add the new folder. None of the files in the folder seem to be recognized.
The project I had copied had been a part of another repo, so it contained hg reference files. I deleted these, and everything added/committed perfectly.
If you want to commit a new file to a repository, you must first add it.
On the command line this can be done in various ways :
hg add which can add a file or a repository and every files it contains.
hg addremove which adds all new files and remove deleted ones.
hg commit -A or hg commit --addremove which are the same thing and a shortcut of hg add remove; hg commit.
I don't remember exactly where the command is in TortoiseHG, but I think if you right-click on the folder in the explorer, the option should be present.
I think I also remember an addremove option somewhere in the commit window, but I may be mistaken.
[UPDATE]
Based on the answer you provided yourself, here is the explanation of why simply adding the files weren't working :
Since the new directory contained repository related information (a .hg directory), Mercurial was treating it as a Subrepository. Subrepositories are repository contained in another, this can, for example, be used to reference a specific version of a library.
Once you delete the .hg directory in your new location, Mercurial didn's saw this as a Subrepo anymore and you were able to add the files normally.