Git: many local changes that I don't want to comment on

Problem:

I cloned the repository, there are some configuration files for adjusting the behavior of the compiled application, I changed some of them (about 10) according to my needs. Now, every time I do something, I have to go line by line in the outputs git status(or “uninstalled files” in my daily GUI) and there are always 10 files that I don’t want to comment on, it's fast becomes annoying.

Is there some unknown (to me) git function or trick to git ignore these 10 files when I need to git status, but when I git pullchange (upstream) the version of these files, I still get a conflict (if any)?

I can’t combine all these files into one big config, partly because they are different, and partly because the application has already been in production several times.

Git aliases probably won't work, because if you don’t need to do anything, I usually use a graphical interface (it’s better to look for diff, convenient control over what to do, etc.), and not gitto the terminal.

+4
source share
3 answers

You can use the .gitignorefile and add paths to these 10 files.

If for some reason you do not want to use .gitignore, you can try .git/info/exclude- it works like .gitignore, but does not appear in git state, since it is in the folder .git.

+2
source

:

:

git checkout -b mybranch

git add <config-files>
git commit -m "my safe of config files"

, chagnge:

git status

,

git pull origin master

( )

, ,

git checkout master
git cherry-pick mybranch

, /

+1

You can set this alias and ignore your configuration files when you want to update the branch using the remote control,

[alias]
   fnm = !git fetch upstream && git merge --no-log --no-ff --no-commit upstream/branch && git reset file/path/not/to/be/updated && git checkout file/path/not/to/be/updated

More explanation here

0
source

All Articles