-
-
Notifications
You must be signed in to change notification settings - Fork 90
Command: git sync
Available since v0.3.10.
git sync
is used to quickly rebase all local branches and commit stacks onto the main branch, without having to check them out individually. It skips any commit stacks which would have merge conflicts unless you pass the --merge
option.
git-sync.mov
Run git sync
:
$ git sync
Attempting rebase in-memory...
[1/4] Committed as: 239f21b7 feat(bug_report): create `bug-report` command
[2/4] Committed as: df8615b4 feat(bug_report): use `bugreport` library to collect extra information
[3/4] Committed as: b18b69fd temp: work on moving individual commits
Attempting rebase in-memory...
[1/1] Committed as: 37364501 cleanup(smartlog): use dedicated arrow character for the checked out branch
branchless: processing 1 update: branch arrow
branchless: processing 1 rewritten commit
branchless: running command: git checkout 37364501ad7d63fcdf0fe3b0c4a5e2a2ae9e7ba0
Previous HEAD position was 50d7a65 cleanup(smartlog): use dedicated arrow character for the checked out branch
branchless: processing 1 update: ref HEAD
HEAD is now at 3736450 cleanup(smartlog): use dedicated arrow character for the checked out branch
branchless: processing checkout
In-memory rebase succeeded.
Synced 50d7a659 cleanup(smartlog): use dedicated arrow character for the checked out branch
Merge conflict for 6935709d feat(bug_report): create `bug-report` command
$ git sl
⋮
◇ 0872cad8 2h feat(sync): add `--update` alias for `--pull`
┣━┓
┃ ◯ 6935709d 3m feat(bug_report): create `bug-report` command
┃ ┃
┃ ◯ 4a7b26eb 3m (bug-report) feat(bug_report): use `bugreport` library to collect extra information
┃ ┃
┃ ◯ aed189f8 3m (move-individual-commits) temp: work on moving individual commits
┃ ┃
┃ ◯ 647a3971 2m temp: some conflicting commit
┃
◇ b5e3416c 3m (remote origin/master) docs: update CHANGELOG.md
┃
● 37364501 6s (arrow) cleanup(smartlog): use dedicated arrow character for the checked out branch
You can also use a revset expression to specify multiple commits (ex. git sync 'stack()'
- otherwise all draft commits will be synced.
By default, git sync
does not update the main branch in the same way that git pull
would. Thus, git sync
will be an idempotent local-only operation.
To match the behavior of git pull
and first fetch the latest main branch from the remote server, run git sync --pull
instead.
By default, git sync
skips any merge conflicts and prints a summary like this at the end:
Synced 50d7a659 cleanup(smartlog): use dedicated arrow character for the checked out branch
Merge conflict for 6935709d feat(bug_report): create `bug-report` command
Here, the first commit stack was successfully rebased on top of the main branch, while the second one would cause a merge conflict.
To resolve merge conflicts, do one of the following:
- Run
git sync --merge
. This will start merge conflict resolution for all conflicting commit stacks, in an unspecified order. - Run a command like
git move -b 6935709d -d origin/main --merge
to start merge conflict resolution for an individual commit stack. You can use the commit hash that was printed in the summary. See thegit move
documentation for more information on how to usegit move --merge
.
- Search the Wiki 🔎
- User guide
- Welcome
- Installation
- Tutorial
- Command overview
- General:
- Navigation:
- Committing:
- Rebasing:
- Verification:
- Collaboration:
- Workflows
- Advanced topics
- Reference
- Developer guide
- Onboarding offer
- Development
- Reference