Friday, February 26, 2021

Bit (1.0) – a modern Git CLI in Go

Twitter Follow

Tweet

bit
GitHub release (latest SemVer) Version Version Version

bit is an experimental modernized git CLI built on top of git that provides happy defaults and other niceties:

  • command and flag suggestions to help you navigate the plethora of options git provides you
  • autocompletion for files and branch names when using bit add or bit checkout
  • automatic fetch and branch fast-forwarding reducing the likelihood of merge conflicts
  • suggestions work with git aliases
  • new commands like bit sync that vastly simplify your workflow
  • commands from git-extras such as bit release & bit info
  • fully compatible with git allowing you to fallback to git if need be.
  • get insight into how bit works using bit --debug.

--- New ---

--- Coming Soon ---

  • improved bit sync
  • more completions!

Install / Update

new versions of bit can now update using bit update

using cURL (Simplest way to install)

Like bit? Sponsor bit for as little as $5

curl -sf https://gobinaries.com/chriswalz/bit | sh;
bit complete;
echo "Type bit then press <ENTER> to show interactive prompt"
bit;

To overwrite installation location

export PREFIX=/opt/bit/git && mkdir -p ${PREFIX} ## optional: override default install location /usr/local/bin

bit, bit checkout & bit switch will show interactive prompts after you press ENTER

using go (Harder way to install)

Caveats: GOPATH and GOBIN need to be set. Verify with go env. If they are not set, add this to your .bashrc or .bash_profile etc. AND open new terminal

export GOPATH=$HOME/go
export GOBIN=$(go env GOPATH)/bin
GO111MODULE=on go get github.com/chriswalz/bit@latest;
bit complete

using Homebrew (For MacOS users)

brew install bit-git
bit complete
bit

Not working? Try brew doctor

using MacPorts (For MacOS users)

sudo port selfupdate
sudo port install bit

using go (For Windows Users)

go env -w GO111MODULE=on

# if latest is not working, replace it with the latest tag found here https://github.com/chriswalz/bit/releases
go get github.com/chriswalz/bit@latest; 
bit

using Chocolatey (For Windows Users)

using zinit

zinit ice lucit wait"0" as"program" from"gh-r" pick"bit"
zinit light "chriswalz/bit"

Note: On Windows only the interactive prompt completion works not classic tab completion

Verify installation with:

bit

Dependencies: Git

Platform Support:

  • iTerm2 (macOS)
  • Terminal.app (macOS)
  • Command Prompt (Windows)
  • WSL/Windows Subsystem for Linux (Windows)
  • gnome-terminal (Ubuntu)

Customization:

  • BIT_THEME=inverted
  • BIT_THEME=monochrome

Bit specific command Usage

Create a new commit (roughly equivalent to git commit -am "commit message")

bit save [commit message]

Save your changes to the current branch [amends current commit when ahead of origin] (roughly equivalent to git commit -a or conditionally git commit -a --amend --no-edit)

bit save

Synchronize your changes to origin branch (Beta) (roughly equivalent to git pull -r; git push)

bit sync

(roughly equivalent to git pull -r; git push; git pull -r origin master; git push) bit sync origin master

You have access to ALL git commands as well.

bit commit -m "I can still use git commands", bit pull -r origin master

Example Workflow

bit switch example-branch Branch does not exist. Do you want to create it? Y/n

yes

Switched to a new branch 'example-branch'

[Makes some changes]

bit save "add important feature"

for multiline commits simply don't put the final quote until you're done typing

[fix an error for important feature]

bit save

[push changes to origin]

bit sync

[two days later confirm your branch is in sync with origin branch]

bit sync

[rebase your changes from origin master]

bit sync origin master

Features

  • Automatic fetching & fast forwarding to keep your branches up to date and prevent merge conflicts
  • Simplify your entire rebase workflow with a single command bit sync
  • Automatic suggestions at your fingertips
  • bit is fully compatible with git. All features of git are available if need be.
Common commands at your finger tips

bit

Commit, bump a tag and push with a single command

bit

Instant git statistics and config information

bit

Principles

  1. Think in the age of the cloud
  2. Embed the spirit of modern day workflows
  3. Favor simplicity over complexity
  4. Bit should have happy defaults
  5. Bit must be fully compatible with Git

Inspiration

Thanks to Gitless, git-extras, researchers in the field and of course the developers of git itself! Also, thanks to go-prompt for the interactive prompt library

News

Changelog

v0.9

v0.8

v0.7

v0.6

v0.5

v0.4

How to uninstall

go binaries are self-contained so uninstalling simply requires deleting the binary(ies)

rm `which bit`
rm `which bitcomplete` 


from Hacker News https://ift.tt/3b0Fg7b

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.