https://github.com/patrickm663/git-sync
A small utility script to sync local Git repos with remote
https://github.com/patrickm663/git-sync
Last synced: 2 months ago
JSON representation
A small utility script to sync local Git repos with remote
- Host: GitHub
- URL: https://github.com/patrickm663/git-sync
- Owner: patrickm663
- License: bsd-3-clause
- Created: 2023-04-09T15:25:08.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-24T20:01:21.000Z (almost 3 years ago)
- Last Synced: 2025-03-06T16:48:46.541Z (about 1 year ago)
- Language: D
- Size: 1.45 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://opensource.org/licenses/BSD-3-Clause)
# git-sync
_**WIP: A D implementation of the Bash script is being tested.**_
A small utility script to sync local Git repos with remote.
It works by looping over the user's `home/` directory for folders containing a `.git` sub-directory. Users are given an option to check the local repo against remote and, only if the user wants, runs `git pull`.
By using `git remote update; git status -uno`, the local repo is checked against remote _before_ running `git pull`. This is safer than running `git pull` outright over each repo, since overwriting local repos may have unintended effects.
## Prerequistes
1. Environment to run Bash scripts
2. Git, grep, and sed installed (should be available on most UNIX and GNU/Linux devices)
## How to Use
The script can be run as follows:
```bash
cd src/
bash git-sync.sh
```
When prompted, enter `y` or `n` at each repository to proceed with checking for updates (non-breaking check).
If updates are available, enter `y` again to pull changes from remote.
## TODO
- [ ] Add further error catches and print helpful error messages
- [ ] Add a small `man` page
- [ ] Implement further tests on different environments
## License
Licensed under BSD 3-Clause.