Tag: gitignore

Git: How to be sure untracked config files aren't silently deleted

My situation is, I suspect, pretty typical. I’m working on a (young) project with some others using git for version control. Our project is a web app which requires local configurations for certain paths and keys spread across a few different config files. We thought a good way to handle this was to make a […]

Un-ignore a directory added to .gitignore

What I did was to have two branches: local production In my local branch I have all my asset folders css, js, and img. And in my production branch I added them to my .gitignore since I want to host those assets elsewhere. css/ img/ js/ so these folders aren’t visible in the production branch […]

Exclude specific subdirectory with gitignore

Let say there is directory structure like this: ├── dir1 │   ├── subdir_1 # do not want this │   │   ├── file1.txt # and this │   │   └── file2.txt # and this │   ├── subdir_2 # keep me in gitignore │   └── subdir_3 # keep me as well └── dir2 └── subdir4 ├── file3.txt └── […]

gitignore: Ignoring a folder (anywhere) except for a subfolder (anywhere)

I want to exclude everything in a folder named foo, except for stuff inside a folder named bar. foo can appear anywhere in the directory structure more than once. bar can appear anywhere in the directory structure under foo. I tried /**/foo/** !/**/foo/**/bar/** but it didn’t work. It still ignores all the foo. It refuses […]

Why does git clean -dX not remove my ignored directory?

I would like git to clean up all untracked files that I have ignored. I thought that git clean -dX was the obvious solution, but it does nothing: # Set up test directory mkdir git-test && cd git-test git init && touch x && git add x && git commit -m Initial mkdir -p folder1/folder2/ […]

.gitignored some files only recently; trying to merge into a previous branch, ignored files show up as conflicts

I had a branch devel from which I branched out A topic branch in the past. devel was always intended to be the parent of A (everything devel had/hadn’t should reflect in A). After a long time, I’ve added some files to .gitignore and updated the index of devel to reflect it. Now I’m trying […]

Git ignore file locally and always merge theirs

I’ve got a git problem, the answer should be somewhere here on stackoverflow but I can’t find it. Imagine a team working on some project with sass or some other builded files. Multiple developers build the files and we want the builded files to be versioned in case a non-developer want to clone and check […]

Git Including an arbitrarily nested subfolder when its parent has been excluded in .gitignore

I’m excluding a folder a and its subfolders, but want to have a specific subfolder b included, where b can be a subfolder somewhere below a, and the exact path to b has not been specified. My .gitignore contains lines: a/** !a/**/b however this does not work. Have tried numerous other permutations of the above, […]

Can't commit local changes for certain files in git

I have some local changes in a file, .classpath with respect to the remote repository. (Yes, I know I shouldn’t have the classpath files in the shared repo, but that’s a different story.) This proves that there are some local changes: $ git checkout master error: Your local changes to the following files would be […]

Exclude files from git clean by default

In a project I am working on I am using git and eclipse, eclipse creates a .project file in the project root. When I do a git clean I do not want to remove this file as I have to create this again. I do want git clean to remove excluded files and directories (since […]

Git Baby is a git and github fan, let's start git clone.