You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add a way to sync remote origin with remote upstream #1160
When working in a typical open-source workflow (for example when contributing to SourceGit on GitHub), there are often two remotes:
our own forked repo (origin)
the master-repo (upstream)
After a Fetch (from all remotes), the origin branches are often lagging behind the corresponding upstream branches. To sync an origin branch against its upstream, we can use Open In Browser in SourceGit (on the origin remote) and then (on the GitHub repo web page) select "Sync fork (origin) branch with upstream". However, it would be nice if this operation could be performed without leaving the SourceGit UI (at least when fast-forward is possible).
Possible (minimal/partial) implementation:
Right-clicking a remote branch origin/develop gives the option Fast-forward to upstream/develop (similar to how it works for local branches).
Other variants for syncing between two remote branches could be added later, but fast-forward is arguably the most common and trivial use-case.
At least initially, it could be assumed that the remote and upstream branch needs to have the same name in order to be synced?
To establish which remote is the upstream, we may need to split the Default Remote dropdown (in Repository Configure) into two separate ones: Default Remote Origin and Default Remote Upstream.
Alternatively, a sub-menu per remote could be used (similar to the one used per branch/tag when right-clicking in the log-graph) to enable syncing between arbitrary pairs of remotes (which may not be as "safe" as requiring configuration of a dedicated Origin + Upstream).
Hmm, I suppose what I actually want is to Sync a remote fork branch with the GitHub CLI. This would help "save time and avoid switching context", but would be specific for GitHub and not general for Git.
I suppose I could setup a Custom Action to run the command gh repo sync <owner>/<fork-repo> --branch <branch-name>.
Things could be somewhat more automated after setting gh repo set-default <owner>/<fork-repo> once in the local repo. Then that default repo is used by default for some gh commands, and we can query the default repo using gh repo set-default --view.
All interfaces to third-party git code hosting services will not be directly integrated in the software. It is recommended that users use Custom Actions.
Fair enough! For reference, I ended upp adding a couple of nifty Custom Actions to my sourcegit fork clone (for the develop and master branches, respectively), like this :
Activity
love-linger commentedon Apr 7, 2025
In fact, you can create a
Custom Actionfor this purpose, such as:goran-w commentedon Apr 7, 2025
To match what the GitHub feature does, there should be one more command, after the ones you listed above (I guess?) :
goran-w commentedon Apr 7, 2025
Hmm, I suppose what I actually want is to Sync a remote fork branch with the GitHub CLI. This would help "save time and avoid switching context", but would be specific for GitHub and not general for Git.
I suppose I could setup a Custom Action to run the command
gh repo sync <owner>/<fork-repo> --branch <branch-name>.Things could be somewhat more automated after setting
gh repo set-default <owner>/<fork-repo>once in the local repo. Then that default repo is used by default for someghcommands, and we can query the default repo usinggh repo set-default --view.love-linger commentedon Apr 8, 2025
All interfaces to third-party git code hosting services will not be directly integrated in the software. It is recommended that users use
Custom Actions.goran-w commentedon Apr 8, 2025
Fair enough! For reference, I ended upp adding a couple of nifty Custom Actions to my sourcegit fork clone (for the develop and master branches, respectively), like this :
Name:
Sync GH fork's branch: developScope:
RepositoryExecutable file:
ghArguments:
repo sync goran-w/sourcegit -b develop✔ Wait for action exit
Works like a charm! (Could be further enhanced by using a script, which does a
git fetch originafterwards.)