So this happens multiple times now, and want to get rid of it. When my framework makes new files on my system, I do a git status, and see then appearing as "modified", but I don't want them to be added / changed to git, I'll have to add them to the gitignore file, right? But when I do that, they still appears in my git status :S So I searched for this problem, and came across:
So I tried that:
git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: bootstrap/cache/services.php <<< so these 3 are already in gitignore, but still shows up :S
modified: composer.lock <<< so these 3 are already in gitignore, but still shows up :S
modified: npm-debug.log <<< so these 3 are already in gitignore, but still shows up :S
no changes added to commit (use "git add" and/or "git commit -a")
folder/projectfolder git rm -r --cached bootstrap/cache/services.php
rm 'bootstrap/cache/services.php'
folder/projectfolder git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: bootstrap/cache/services.php
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: composer.lock
modified: npm-debug.log
folder/projectfolder git rm -r --cached composer.lock
rm 'composer.lock'
folder/projectfolder git rm -r --cached npm-debug.log
rm 'npm-debug.log'
folder/projectfolder git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
(use "git push" to publish your local commits)
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)
deleted: bootstrap/cache/services.php
deleted: composer.lock
deleted: npm-debug.log
folder/projectfolder git commit -m "clean gitindex"
[master 084a4e1] clean gitindex
Committer: ********
3 files changed, 13823 deletions(-)
delete mode 100644 bootstrap/cache/services.php
delete mode 100644 composer.lock
delete mode 100644 npm-debug.log
folder/projectfolder git status
On branch master
Your branch is ahead of 'origin/master' by 2 commits.
(use "git push" to publish your local commits)
nothing to commit, working directory clean
folder/projectfolder git push
warning: <<<message and login removed here>>>
Counting objects: 9, done.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (6/6), 582 bytes | 0 bytes/s, done.
Total 6 (delta 4), reused 0 (delta 0)
To https://*****@bitbucket.org/*****/*****.git
45ty54y4y54y******y4t43at master -> master
But after doing this, when my colleague pulls my changes from git, the 3 files are actually deleted from his system, not only from the git index. how can I make git just ignoring all my files in gitignore as it should, without touching filesystems on any machine?
Actually I just only need a "Hey git, go fix your shit and please look at the ignore file before you tell me that things are changed" command ;P
Bart