Crates.io | git-branchless |
lib.rs | git-branchless |
version | 0.10.0 |
source | src |
created_at | 2021-03-15 23:44:46.023122 |
updated_at | 2024-10-14 19:48:45.317602 |
description | Branchless workflow for Git |
homepage | https://github.com/arxanas/git-branchless |
repository | https://github.com/arxanas/git-branchless |
max_upload_size | |
id | 369460 |
size | 687,125 |
(This suite of tools is 100% compatible with branches. If you think this is confusing, you can discuss a new name here.)
▼ Jump to installation ▼
▼ Jump to table of contents ▼
git-branchless
is a suite of tools which enhances Git in several ways:
It makes Git easier to use, both for novices and for power users. Examples:
git undo
: a general-purpose undo command. See the blog post git undo: We can do better.git restack
: to repair broken commit graphs.It adds more flexibility for power users. Examples:
git sync
: to rebase all local commit stacks and branches without having to check them out first.git move
: The ability to move subtrees rather than "sticks" while cleaning up old branches, not touching the working copy, etc.git next/prev
: to quickly jump between commits and branches in a commit stack.git sw -i/--interactive
: to interactively select a commit to switch to.It provides faster operations for large repositories and monorepos, particularly at large tech companies. Examples:
git status
or invalidate build artifacts).git-branchless
provides the fastest implementation of rebase among Git tools and UIs, for the above reasons.See also the User guide and Design goals.
Undo almost anything:
git reflog
?git reflog
is a tool to view the previous position of a single reference (like HEAD
), which can be used to undo operations. But since it only tracks the position of a single reference, complicated operations like rebases can be tedious to reverse-engineer. git undo
operates at a higher level of abstraction: the entire state of your repository.
git reflog
also fundamentally can't be used to undo some rare operations, such as certain branch creations, updates, and deletions. See the architecture document for more details.
git undo
handle?git undo
relies on features in recent versions of Git to work properly. See the compatibility chart.
Currently, git undo
can't undo the following. You can find the design document to handle some of these cases in issue #10.
git reset HEAD^
.git uncommit
command instead. See issue #3.git status
shows a message like path/to/file (both modified)
, so that you can resolve that specific conflict differently. This is tracked by issue #10 above.Fundamentally, git undo
is not intended to handle changes to untracked files.
gitjk
: Requires a shell alias. Only undoes most recent command. Only handles some Git operations (e.g. doesn't handle rebases).git-extras/git-undo
: Only undoes commits at current HEAD
.git-annex undo
: Only undoes the most recent change to a given file or directory.thefuck
: Only undoes historical shell commands. Only handles some Git operations (e.g. doesn't handle rebases).Visualize your commit history with the smartlog (git sl
):
git log --graph
?git log --graph
only shows commits which have branches attached with them. If you prefer to work without branches, then git log --graph
won't work for you.
To support users who rewrite their commit graph extensively, git sl
also points out commits which have been abandoned and need to be repaired (descendants of commits marked with rewritten as abcd1234
). They can be automatically fixed up with git restack
, or manually handled.
Edit your commit graph without fear:
git rebase --interactive
?Interactive rebasing with git rebase --interactive
is fully supported, but it has a couple of shortcomings:
git rebase --interactive
can only repair linear series of commits, not trees. If you modify a commit with multiple children, then you have to be sure to rebase all of the other children commits appropriately.When you use git rebase --interactive
with git-branchless
, you will be prompted to repair your commit graph if you abandon any commits.
See https://github.com/arxanas/git-branchless/wiki/Installation.
Short version: check for packages in the repositories appropriate for your system or run cargo install --locked git-branchless
. Once installed, run git branchless init
in your repository.
git-branchless
is currently in alpha. Be prepared for breaking changes, as some of the workflows and architecture may change in the future. It's believed that there are no major bugs, but it has not yet been comprehensively battle-tested. You can see the known issues in the issue tracker.
git-branchless
follows semantic versioning. New 0.x.y versions, and new major versions after reaching 1.0.0, may change the on-disk format in a backward-incompatible way.
To be notified about new versions, select Watch » Custom » Releases in Github's notifications menu at the top of the page. Or use GitPunch to deliver notifications by email.
There's a lot of promising tooling developing in this space. See Related tools for more information.
Thanks for your interest in contributing! If you'd like, I'm happy to set up a call to help you onboard.
For code contributions, check out the Runbook to understand how to set up a development workflow, and the Coding guidelines. You may also want to read the Architecture documentation.
For contributing documentation, see the Wiki style guide.
Contributors should abide by the Code of Conduct.