Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Git Repository Sync Tool (syncgit)

A simple bash script to help sync your Git repositories with their upstreams on GitHub.

Idea behind this!

I have many repositories that I usually sync (push / pull) on daily basis to ensure my laptop and PC are in sync. These are very basic and common repositories such as my dot files repo, my drafts, documents (all in Markdown), gists, etc.

This script is also part of my automation workflow, you can checkout watchexec service and my articles on Medium.com for more ideas about my automation workflows.

Features

  • Backup: Auto-commit and push local changes
  • 🔄 Pull: Fetch and merge upstream changes
  • 🔍 Compare: View local/remote differences
  • Add Repos: Easily track new repositories
  • 🎨 Color-coded output for clear status
  • 🚀 Bulk operations on all repos at once

Quick Start

  1. Install:

    git clone https://github.com/hanymamdouh82/syncgit.git -o ~/syncgit
    chmod +x ~/syncgit/syncgit.sh ~/syncgit/utils.sh 
    PATH=$PATH:$HOME/syncgit
  2. Configure:

    echo "/path/to/your/repo1" >> ~/syncgit/repos.config
    echo "/path/to/your/repo2" >> ~/syncgit/repos.config
  3. Run:

    ./syncgit.sh

Usage Examples

Command Description
./syncgit.sh Interactive mode
./syncgit.sh b A Backup all repos
./syncgit.sh p 2 Pull changes for repo #2
./syncgit.sh c A Compare all repos
./syncgit.sh a ~/new-repo Add new repository

Detailed Documentation

Operation Flags

Flag Operation Description
b Backup Commit+push local changes
p Pull Fetch+merge remote changes
c Compare Show local/remote diff
a Add Track new repository

Configuration File

Edit repos.config to manage tracked repositories:

# Format: One path per line
/path/to/repo1
/path/to/repo2
# Comments start with #

Requirements

  • Bash 4.0+
  • Git 2.0+
  • Coreutils (date, ping, etc.)

FAQ

Q: How do I see which repos are tracked?
A: View your repos.config file or run compare (c A)

Q: Why won't my changes backup?
A: Backup only runs if you have uncommitted changes AND your local is ahead

Q: How do I reset the config?
A: Simply delete or edit repos.config

License

This project is licensed under the GNU General Public License v3.0.
By using, distributing, or modifying this software, you agree to the terms in LICENSE.

Key requirements:

  • 🛑 Disclose source: Modified versions must be open-sourced under GPL-3.0
  • 📜 Include license: All copies must retain this notice
  • 🔗 Same license: Derivatives must use GPL-3.0

Full terms: https://www.gnu.org/licenses/gpl-3.0.en.html


Created by Hany Mamdouh - Report issues here

About

A simple bash script to help sync your Git repositories with their upstreams on GitHub. This tool provides basic operations like backup, pull, compare, and adding new repositories to your tracking list.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages