Skip to content

Commit

Permalink
chore: document new cli options
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippHeuer committed Dec 13, 2024
1 parent 8c012ac commit 4245957
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
44 changes: 31 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ servers:
- url: https://github.com
type: github
auth:
# you can provide your personal access token directly or in a file
username: YourAccount
password: <readOnlyPersonalAccessToken>
password-file: /path/to/file
Expand Down Expand Up @@ -43,29 +42,48 @@ chmod +x ~/.local/bin/reposync

## Usage

### Index
### Clone

> This is work-in-progress and not yet implemented.
`reposync clone` will clone all repositories you have access to into the target directory, keeping the remote structure as close as possible.

Before your first run, you can use `reposync index /old-project-dir`, to add your local projects into the reposync state.
When running `reposync clone`, it will then move the projects to the new location, instead of cloning them.
**Notes:**

### Clone
- tracked repositories might be moved to track the remote structure changes (`<namespace>/<projectName>`).

### Pull

`reposync pull` will pull the latest changes for all tracked repositories.

- `git fetch`
- `git pull --ff-only`

`reposync clone` will clone all projects you have access to into a target directory.
It will also move existing projects to mirror the remote structure (`<namespace>/<projectName>`).
### List

### Update
`reposync list` will list all tracked repositories.

`reposync update` will pull the latest changes from the remote server for tracked projects.
Additional options:

- `--format` (`-f`) -> specify the output format (table, json, csv, ...)
- `--columns` (`-c`) -> filter output by columns

### HouseKeeping

`reposync housekeeping` (`reposync hk`) will run the following tasks for all repositories:

- `git prune --expire now`
- `git gc --auto`
- `git fsck --full --unreachable --strict`
- `repack` -> `git repack -a -d --write-bitmap-index`
- `prune` -> `git prune --expire now`
- `gc` -> `git gc --auto`
- `fsck` -> `git fsck --full --unreachable --strict`
- `commit-graph` -> `git commit-graph write --reachable`

You can choose to only run a subset of the tasks by specifying them as arguments. For example, `reposync hk --jobs repack prune`.

### Index

> This is work-in-progress and not yet implemented.

Before your first run, you can use `reposync index /old-project-dir`, to add your local projects to the known repositories.
When running `reposync clone`, it will then move the projects to the new location, instead of cloning them.

### Rules

Expand Down
2 changes: 1 addition & 1 deletion pkg/repository/clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func FetchRepository(target string, silent bool) error {

func PullRepository(target string, silent bool) error {
// pull using git cli
cmd := exec.Command("git", "pull")
cmd := exec.Command("git", "pull", "--ff-only")
cmd.Dir = target
if !silent {
cmd.Stdout = os.Stdout
Expand Down

0 comments on commit 4245957

Please sign in to comment.