Gitwatch: Exclude swap files

Created on 2 Jan 2018  ·  8Comments  ·  Source: gitwatch/gitwatch

The title is self-explanatory : I'd like to be able to exclude swap files from push, because it makes a lot of unwanted commits.

I tried adding

--exclude=\"^${TARGETDIR}/*.swp\"

or changing to

--exclude=\"^${TARGETDIR}/.git|^${TARGETDIR}/.swp\"

But it doesn't seem to work, maybe the regexp is wrong?

Most helpful comment

It would be much better to use .gitignore and check status before trying to commit. Here is my way to do it:
https://github.com/elnull/gitwatch/commit/c9f4b43b6c8a3dfe077f169c723c00b3d2840072

All 8 comments

It would be much better to use .gitignore and check status before trying to commit. Here is my way to do it:
https://github.com/elnull/gitwatch/commit/c9f4b43b6c8a3dfe077f169c723c00b3d2840072

I also copy that: gitwatch has to respect .gitignore content for not committing. It is a constant pain otherwise. The only option is to manually synchronize .gitignore with all calls of gitwatch :-(

Since I use external git bare repository for auto commits (with --git-dir option) I don't place .gitignore in watched directory.

Can we please merge the solution from @elnull to master?

Does the below fix, which has now been merged in to master, in solve this problem? It uses git status, which should be observing .gitignore.

https://github.com/gitwatch/gitwatch/pull/44

Did something go wrong during the merging of #44 ? The changes are not included in the current versions of the script.

Thanks for catching this @DeKubus; I lost it in the big merge of the long-separate devel branch, when that happened in commit 332538e. I'll get that back in there.

Git status check code is now back in. Thanks again, @DeKubus. I'm closing this issue; feel free to speak up if something is still awry.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hongkongkiwi picture hongkongkiwi  ·  3Comments

lehnerpat picture lehnerpat  ·  7Comments

datag picture datag  ·  9Comments

miguelarauj1o picture miguelarauj1o  ·  7Comments

yqiang picture yqiang  ·  3Comments