Git auto-commit & push every couple of minutes
Jul 13, 2020 21:30 · 158 words · 1 minute read
|
|
What does it exactly do?
- watch executes a command periodically
- git ls-files lists all modified files, and all “other” (e.g. untracked) files. Additionally, we make sure the usual
.gitignore
rules apply via the flag--exclude-standard
. The important part is to then to do a wildcardgrep
search on the result (".
" stands for “any character is fine”). But we are not interested in the actual result, and therefore throw it away by redirecting the output to/dev/null
. We are interested in the exit state:grep
exits with an error code in case no result is found. Thus, only if there are uncommitted changes, the program continues, where we actually add, commit, and push the changes.
Check out the exact explanations for the git
parts with ExplainShell 😁
- You are in control
- My Favorite Shortcuts for VS Code
- Customizing my shell: From bash to zsh to fish
- JSON5: JSON with comments (and more!)
- jq: Analyzing JSON data on the command line
- Get Total Directory Size via Command Line
- Changing DNS server for Huawei LTE router
- Notes on Job & Career Development
- Adding full-text search to a static site (= no backend needed)
- Generating a random string on Linux & macOS