How to view the untracked files in a JGit RevCommit? - egit

I'm working on a Git Client based on JGit and I'm trying to implement stash support. To display the files in the stash, I used the git.diff () command, but the untracked files are not shown. For the other file types it works great. How can I view untracked files as well?

Related

Can github desktop be configured to ignore untracked files

Is it possible to configure the github desktop client to show only files that are in the repo, same as what gitk seems to do by default, or similar to running git status --untracked-files=no from the command line?
In some repository directories there are a ton of untracked files that I don't want to delete or add to .gitignore, I just want to 'hide' them when I'm diffing the important files. (I use github desktop only to review changes, not to push or create PRs.)
GitHub desktop is initially not designed to hide all untracked files in a working branch. Unfortunately there is neither a workaround for doing this. Here is the link that talks about adding this change as an update in its future releases.
https://github.com/desktop/desktop/issues/3734

why can't I see some of my folders in github?

I upload the whole working folder to git but I cannot access some of my folders.
My local directory:
On GitHub:
Where is my vendors directory?
Assuming that all of the files and directories you have shown were 'committed' and 'pushed' to GitHub, the most likely reason why they do not show up in GitHub is because, as Chris noted in the comments, the resources and vendors directories will not actually be available for adding into a commit if they contain no files.
Let's say I have the following setup:
test/
--test.txt
--test1/
--test1.txt
--test2/
If I run git status after running git init, the following will be displayed:
$ git status
On branch master
Untracked files:
(use "git add <file>..." to include in what will be committed)
test.txt
test1/
nothing added to commit but untracked files present (use "git add" to track)
Note how test2, despite being present in the directory, is ignored by git entirely, while test1, which contains a file, is noted as having changes by git. The same may be happening to you.
Alternatively, there may be ignore patterns set in a .gitignore, etc (refer to the comments on the question).
git doesn't store folder changes, it stores file changes
Add a hidden file called .keep to each folder

How to ignore eclipse metadata but preserve the template?

I've got an ARM project in Eclipse...Actually, I'm using the STM Workbench packaging of Base-CDT-Eclipse.
I'm working with a few other guys and we're using a git server to push and pull from.
However, everyone has a little bit different setup as far as where their toolchains are, OS's, etc.
This is causing trouble, because we're git dummies, and when we push changes after working locally, we do
git add .
git commit -m "some message"
git push origin master
And when we pull changes, we just do
git pull origin master
And pray that there no one else did anything in the meantime, because we're afraid of merging differences, but that's a different story.
Anyway, this whole project has a few sub directories that include things like datasheets, Word documents, and what-not...but, it also includes the metadata for the Eclipse project. So, the last person to commit also pushes their unique settings for things like tool-chain path, preferred builder, etc. This breaks the other guys' setup and after each pull, everyone else has to manually update their project settings to fix this.
So, what files are special to Eclipse for project settings and how can I tell git to ignore these files if they already exist? They need to be available for, say, a git clone but they need to be ignored for subsequent git push's and git pull's.
If you need the setting file and not rename it and it's ok forsetting file need not to do version control, so there is a way by .gitignore with below steps:
Create a .gitignore file. touch .gitignore
Edit and save the .gitignore file
.gitignore
filename
Remove the caches from version control. git rm --cached filename
Commit and push
You can ignore those files changes locally with:
git update-index --skip-worktree -- .project
git update-index --skip-worktree -- .classpath
See: "Difference Between 'assume-unchanged' and 'skip-worktree'", it should better resist to git pull.
Another option would be to a content filter driver which generates (automatically on git checkout) a .classpath if it does not yet exist.
That allows you to version a .classpath.tpl template, and you can keep your actual .classpath completely private (and in your .gitignore)
See this answer for more.

Merging conflict with Unity Script Assemblies

I want to be able to merge my changes to the main repository branch. I accidentally merged all my Unity files on the last merge and I think that caused an error for my next merge . I get the following error:
% hg --repository C:\kiln\development merge --verbose --tool=internal:fail 4595
~/Assembly-CSharp-Editor.pidb: untracked file differs
~/Assembly-UnityScript-Editor.pidb: untracked file differs
~/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll: untracked file differs
~/Library/ScriptAssemblies/Assembly-CSharp-Editor.dll.mdb: untracked file differs
~/Library/ScriptAssemblies/Assembly-UnityScript-Editor.dll: untracked file differs
~/Library/ScriptAssemblies/Assembly-UnityScript-Editor.dll.mdb: untracked file differs
~/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll: untracked file differs
~/Library/ScriptAssemblies/Assembly-UnityScript-firstpass.dll.mdb: untracked file differs
abort: untracked files in working directory differ from files in requested revision
I'm not sure what to do now. I was thinking about deleting those files from my local repository and then pulling from the main repo. However, I'm afraid those files might damage my game somehow.
What should I do?
In general you should not check the Library folder into Mercurial. From the Unity Manual:
When checking the project into a version control system, you should add the Assets and the ProjectSettings directories to the system. The Library directory should be completely ignored - when using external version control, it's only a local cache of imported assets.
(see also http://docs.unity3d.com/Documentation/Manual/ExternalVersionControlSystemSupport.html)
Specific to your question: All dll and mdb-files in the Library/ScriptAssemblies folder are automatically regenerated from your code files so you can safely delete these files. Unity will regenerate them when it's recompiling the code in your project.

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.