The problem:
I cloned a repository, there are some configuration files to customize the behaviour of the compiled app, I changed some of them (about 10) to suit my needs. Now, every time I commit something, I have to go through line by line in the output of git status
(or "unstaged files" in my daily used GUI), and that 10 files, which I don't want to commit, are always there, this quickly becomes annoying.
Is there some unknown (to me) feature of git or trick to let git ignore these 10 files when I need git status
, but when I git pull
the changed (by upstream) version of these files, I still get a conflict (if there is one)?
I cannot merge all these files into one big config, partly because they are different things and partly because the app is running in production for some times now.
Git aliases probably won't work, for if nothing fancy needs to be done, I usually use a GUI, (better looking diff, convenient control of what to commit, etc.), not git
in a terminal.
There are two Git commands a developer must use in order to discard all local changes in Git, remove all uncommited changes and revert their Git working tree back to the state it was in when the last commit took place. The commands to discard all local changes in Git are: git reset –hard. git clean -fxd.
Use Git update-index to ignore changes To resume tracking, run the git update-index command with the --no-skip-worktree flag. Or, you can temporarily stop tracking a file and have Git ignore changes to the file by using the git update-index command with the assume-unchanged flag.
You can use .gitignore
file and add paths to these 10 files there.
If for some reason you don't want to use .gitignore
, you may try .git/info/exclude
- it works like .gitignore
, but is not shown in git status, as it is in .git
folder.
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