So, I learn git functions, but cannot make the file README.md
executed from git branch update in the file .gitignore
.
I had wrote the next in .gitignore
but it does not help during push on server.
// .gitignore
# readme
README.md
LICENSE
There is some crucial information you are missing. git
tracks files as soon as you add them to the staging area. And once they are committed they will be tracked even when added to .gitignore
and since your README
is already added to git so git
will track changes made to this file.
So adding it to your .gitignore
as you already did will not work since it will be tracked by git from now on.
You can use the assume-unchanged
assume-unchanged
// Mark local fule so git will not detect local changes
git update-index --assume-unchanged <file>
// To get a list of dir's/files that are marked as assume-unchanged
git ls-files -v|grep '^h'
// To un-mark files
git update-index --no-assume-unchanged <file>
assume-unchanged
aliasesgit config --global alias.hide "update-index --assume-unchanged"
git config --global alias.show "update-index --no-assume-unchanged"
git config --global alias.list-unchanged "ls-files -v|grep '^h'"
Now your .gitconfig
should have the following aliases:
[alias]
hide = update-index --assume-unchanged
unhide = update-index --no-assume-unchanged
list-unchanged = ls-files -v|grep '^h'
git hide myfile.ext
git unhide myfile.ext
If you are using SourceTree you add custom action:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With