0

Im trying to not include some files to be commit. For example, I don't want any change in the following files to be included in a commit:

bootstrap/start.php

So I include them in .gitignore like this:

/bootstrap/compiled.php
/bootstrap/start.php
/vendor
composer.phar
composer.lock
.env.local.php
.env.php
.DS_Store
Thumbs.db.idea
.idea/
/public/dbase
/public/user_images
/app/config/lenovo

but when Im running git status I still get this message:

On branch master
Your branch is up-to-date with 'origin/master'.

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:   .gitignore
    modified:   bootstrap/start.php

no changes added to commit (use "git add" and/or "git commit -a")

How to do that? thank you

2 Answers 2

2

bootstrap/start.php is already tracked by git.

from the gitignore docs "A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below for details."

Sign up to request clarification or add additional context in comments.

4 Comments

what is that mean? will any changes in bootstrap/start.php still commited ?
it means that you have added bootstrap/start.php to the git repository and git is tracking the changes to the file. You can tell git to stop ignore changes to a tracked file via the command git update-index --assume-unchanged bootstrap/start.php and you can then restart tracking of those changes with git update-index --no-assume-unchanged bootstrap/start.php
git update-index --assume-unchanged bootstrap/start.php this works, if I run git status the bootstrap/start.php not listed anymore ... thank you sir :) . I don't want any change in that file tracked by git so I don't need to run git update-index --no-assume-unchanged bootstrap/start.php right?
Yep...only run that if you want to reenable tracking of changes sometime in the future
0

Try this.

git update-index --assume-unchanged bootstrap/start.php

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.