https://github.com/atusy/git-worksync
https://github.com/atusy/git-worksync
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/atusy/git-worksync
- Owner: atusy
- License: other
- Created: 2021-09-13T12:18:36.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-04T12:36:08.000Z (over 3 years ago)
- Last Synced: 2025-02-03T11:11:42.336Z (18 days ago)
- Language: Shell
- Size: 23.4 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - atusy/git-worksync - (Shell)
README
# git-worksync
Extend `git worktree add` by syncing untracked and ignored resouces.
## Install
1. Install dependencies: [Git](https://git-scm.com/) and optionally [mikefarah/yq](https://github.com/mikefarah/yq).
1. Download [git-worksync](git-worksync) to one of your path (e.g., `~/.local/bin`)
1. Let the file be executableFor example,
``` bash
wget -O "$HOME/.local/bin/git-worksync" https://raw.githubusercontent.com/atusy/git-worksync/main/git-worksync
chmod +x "$HOME/.local/bin/git-worksync"
```## Getting started
`git worksync` extends `git worktree add`, and remains compatibility at the same time.
By default, `git worksync` creates hard links for the untracked and symbolic links for the ignored.
This design has chosen for the following reasons.- Hard links are suitable for `git add `
- Symbolic links are suitable for synchronizing ignored directories (e.g., .venv/, data/, ...) after adding the new worktree.The behavior can be tweaked by command line options or by a YAML file (require [mikefarah/yq](https://github.com/mikefarah/yq)).
The deafult path for the YAML file is `.worksync.yml` at the root of repository.
However, it can also be changed by the `WORKSYNC_CONFIG` evironmental variable or by the `--config=` option.Details are available from `git worksync --help`.
### Examples
```bash
# Sync the untracked by hard links, and the ignroed by symbolic links
git worksync []# Sync the ignored by hard links
git worksync [] --untracked=symbolic-link# Sync the ignored by hard links according to the YAML file
echo "ignored: hard-link" > "$(git rev-parse --show-toplevel)/.worksync.yml"
```