important files are not in list , all some files go in untract files list? - github

I am using a Git Repository to manage my project,
Now when i try to commit i see there are some impoertant file like content/image , scripts , etc files in untrack files
Why?
Is there any way to resolve this?
Regards,
vinit

You have to use "git add [wildcard or directory or file(s)]" first to add your files to the versioning system GIT. Manual page is here: https://www.kernel.org/pub/software/scm/git/docs/git-add.html
And the git book is worth a read.
Also I liked gitready very much.
Happy coding

If your Git repo has been initialized on GitHub (and then cloned), it is likely to come with a .gitignore (as well as a README.md, and even a LICENSE file).
Check if those files aren't ignored by the rules in the .gitignore.
You can do that with:
git check-ignore -v scripts
You can edit that file to remove the rules you don't want, then a git add . will add:
the modified .gitignore files
the files that were previously ignored.

Related

SourceTree permanent local discard

I am new to Sourcetree and source control in general. I am working on an Android project with a few other people and use bitbucket as the repository. I have learned the basics but don't want to track certain files in my local, specifically a lot of the gradle and iml files. But i think Stop tracking will remove those from the repo. Is there a way to just have source tree ignore any changes i make to certain files locally but not delete them from the repo ?
Thank you in advance
You can create a file and name it .gitignore in the root of the project and in that file place every directory to exclude by git like:
my_folder
my_folder2
The above would be excluded from git tracked files.
If you are already tracking files this command will remove them from index:
git rm -r --cached <folder>

stop git from tracking a file without removing the file from other developers machine

I have a file name settings.py. In my host machine settings.py has a different configuration with that of other developers. I want to stop git from tracking settings.py but not to delete this file from other developers machine when ever they pull changes in the project
Some people talk about including the file in .git/info/exclude folder.
But i have no idea as where to locate this file. I searched for it in my project folder( where git has been initialize). To no avail.
expected result
When ever i commit changes, all changes are push to master except my settings.py file, but not deleting this file from other developers machine when ever they pull my changes.
You already mentioned the correct answer. You can use .git/info/exclude as also documented here.
If you have not created this file yet, you can do so now. Simply place a text file called exclude in .git/info. The .git folder should be present already in the root of your repository.
The file uses the same syntax as a regular .gitignore file, but will only be applied to you.
You can also manually specify a core.excludesfile as described in this answer:
git config --global core.excludesfile ~/.gitignore

Github - gitignore folder doesn't exclude all directory files

I'm using Github Desktop on Windows 10. I have a .gitignore file with which I'd like to ignore everything in the directory, including all subdirectories.
What's frustrating is that most files are excluded, but I'm still getting a few random files that I cannot seem to ignore.
I have a directory, say, My Dir/Sub-dir, I want to ignore. I also want to ignore all files of extension, say, *.swf. Thus, I write this .gitignore file:
My Dir/Sub-dir
*.swf
But, when I go back to Github Desktop, I still get two files similar to the following in the list:
My Dir/Sub-dir/anotherdir/randomfile.xml
My Dir/Sub-dir/animation.swf
What's going on? Is this a bug? Or am I missing something?
EDIT:
Other alternative .gitignores I've tried are:
My*Dir/Sub-dir
*.swf
My\ Dir/Sub-dir
*.swf
My Dir/Sub-dir/
*.swf
/My Dir/Sub-dir
*.swf
EDIT:
So, I've tried the git rm --cached <file> command on my files, and it worked - until one of the files changes again. Github Desktop then once again says they need to be updated.
p.s. It may be that they somehow got indexed in the master branch, as I'm currently in a different branch. Would this cause it? And, if so, how would I eliminate these files from all branches?
To ignore all trees under specific directories, append the trailing slash to the directory:
# Ignore directory at all levels, even if the directory is nested under other directories
My Dir/Sub-dir/
# Ignore the directory only if it exists at the root of your repository
/My Dir/Sub-dir/
# Ignore the sub-directory, no matter where it appears within your repository
Sub-dir/
# Ignore all swf files
*.swf
If you are continuing to experience difficulties, your problem may be that the files you wish to ignore are already indexed by git (via the git add command). If the files are not committed yet, you can remove them from the index with git reset -- 'My Dir/Sub-dir/'. If your files have been committed, you can remove them from the index with git rm --cached <file>.
I guess the whitespace could be a problem. Try
My\ Dir/Sub-dir
or
My*Dir/Sub-dir
This could be a good reference .gitignore entire directory with whitespace in name

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.

.factorypath added to .gitignore is not taken into account

In .gitignore under the same directory there is
.factorypath
/.factorypath
added for eclipse project. But whenever any change occur in this file it is still visible as modified under git or smartgit.
Any idea why ?
Most likely the file .factorypath was added to git before you excluded it in .gitignore. From the gitignore documentation (http://git-scm.com/docs/gitignore):
NOTES
The purpose of gitignore files is to ensure that certain files not tracked by Git remain untracked.
To stop tracking a file that is currently tracked, use git rm --cached.
To show files currently tracked by git you can use git ls-files.
As stated in the quote above to stop tracking the file use:
git rm --cached .factorypath.
This will keep your working tree copy of the file but remove it from the index.
It's because the file was previously tracked. With that in mind, this question already has been answered here.