I have a project and it has a lot of directories containing .dll files. Now I want to ignore all files having .dll extension from all directory. I have .gitignore file in root directory.I tried many combinations but none seems to work.
Please help
Just use
*.dll
That will ignore all .dll files recursively, in all folders.
Ignoring files
From time to time, there are files you don't want Git to check in to GitHub. There are a few ways to tell Git which files to ignore.
Create a local .gitignore
If you create a file in your repository named .gitignore, Git uses it to determine which files and directories to ignore, before you make a commit.
A .gitignore file should be committed into your repository, in order to share the ignore rules with any other users that clone the repository.
GitHub maintains an official list of recommended .gitignore files for many popular operating systems, environments, and languages in the github/gitignore public repository.
In Terminal, navigate to the location of your Git repository.
Enter touch .gitignore to create a .gitignore file.
The Octocat has a Gist containing some good rules to add to this file.
If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later. In those cases, you must untrack the file first, by running the following command in your terminal:
git rm --cached FILENAME
Create a global .gitignore
You can also create a global .gitignore file, which is a list of rules for ignoring files in every Git repository on your computer. For example, you might create the file at ~/.gitignore_global and add some rules to it.
Open Terminal.
Run the following command in your terminal:git config --global core.excludesfile ~/.gitignore_global
Related
Grunt is not ignoring files besides it's not loading the files as per the priority given in gruntjs Please check the image
There is no image attached, but did you add the folder or file to the .gitignore file after they were already commited? In that case you might need to clear the git cache. See link below
How to make Git "forget" about a file that was tracked but is now in .gitignore?
I want to remove the meteor installation from my meteor project directory while keeping my source code intact, so that I can archive the project without the installed packages. I also want the package configuration to be retained in the archive so that I can re-install the project without having to re-add and re-remove the packages again.
How do I do this?
Meteor already creates a .gitignore file for you. That file tells you everything that should be archived. So you can simple look at that file and only archive that (either by deleting everything else, or just writing a script that reads the .gitignore file and interprets it). Alternatively, of course, you could just add everything to git (in which case git will interpret the .gitignore file for you), and then create an archive from the git repo.
Of course, that .gitignore file only excludes .meteor/local, so as Kyll already said, you could just delete that folder.
When we pull a revision from Github than it is not ignoring the files and directories which are placed in .gitignore file.
It is pulling all the files and directories.
How to resolve this issue? I need to ignore some files and directories when pulling from github.
This is how my current .gitignore file looks like -
/vendor
/node_modules
Homestead.yaml
Homestead.json
.env
.idea/workspace.xml
/config/test
/storage/logs/laravel.log
I suspect what is happening is, the files you are trying to ignore using .gitignore were previously tracked (before ignore statements were added).
So to make the repository forget the files in git ignore look at this answer here:
How to make Git "forget" about a file that was tracked but is now in .gitignore?
That being said, if you actually "mean" exactly what you have written in your question, that suggests your understanding of how .gitignore works is flawed.
.gitignore does not prevent the files from being pulled down from the repository. It prevents them from getting committed to a repository in the first place.
I'm using Sourcetree on OS X. I'm working on a WordPress project. For some reason, changes I make in the 'themes' directory are not being shown as Unstaged files. If I add a test file to /wp-admin/ or /wp-content/ it shows the test file as unstaged. I can't figure out why themes files are not being tracked.
I checked .gitignore and it's empty.
Any help is appreciated. Thanks!
To clarify the question. If SourceTree fails to recognize un-tracked files here are some steps you should take.
Double check that you are not listing the file/directory in .gitignore
Open up a GIT console for that repository and run git status This should show whether any changes are detectable by GIT.
Go to the directory in which you are having problems and look to see if you have any .gitignore files or .git folders. If they exist then deleting them should allow you to add these files to your repository
Caution:
Sometimes having a Repo inside a repo is by design (often referred to as a sub-repository) and could cause issues if removed.
Edit:
I just replicated this scenario with two repos and source tree appeared to see the untracked files once the .git was removed.
Could you open up a terminal window to that themes directory and do an ls -a?
If you use SourceTree, open the terminal and use git add <fileName> -f to force shown any changes in this folder then you can push to Bitbucket
As title suggest, I want to know if there is a single git command that put all my project in one folder first (not including .gitignored files) and then proceed archiving the folder— leaving ignored files not included when archiving which is nice.
This can be beneficial for me as I am working on WordPress plugin with multiple release. Some references.
I want all the files (minus the .gitignored files) move to a folder first then proceed archiving that folder
It is possible in one command provided you define an alias but this isn't git-related:
you can:
clone your repo elsewhere (that way you don't get any ignored or private file)
move your files as you see fit in that local clone
archive (tar cpvf yourArchive.tar yourFolder)
But git archive alone won't help you move those files, which is why I would recommend a script with custom bash commands (not git commands).
You don't really need to copy / clone the repo anywhere.
Make sure you committed all your changes.
Process the files any way you want.
Run tar -cvjf dist/archive-name.tbz2 --transform='s,^,archive-name/,' $(git ls-tree --full-tree -r --name-only --full-name HEAD)
run git reset --hard to restore without any of the changes you made in step #2.
Hints:
The --transform='s,^,archive-name/,' is so your files will be extracted toarchive-name/....`, you can remove it if you don't need that.