Git with less typing

gg: Git with less typing

gg is an alternative command-line interface for Git heavily inspired by Mercurial. It's designed for less typing in common workflows and make Git easier to use for both novices and advanced users alike.

  • Abbreviations. git commit -a takes 13 characters to type. gg ci takes 5 to do the same thing. Don't worry, you can still type gg commit: most common operations have shorter aliases.
  • Built for GitHub and Gerrit. gg has built-in support for creating pull requests and creating Gerrit changesets straight from the command-line. No more context switching.
  • Safer rebases. gg rebase automatically detects common mistakes while rebasing and infers the correct change.
  • Local branches match remote branches. Using gg pull automatically creates branches that match your remotes to avoid confusion.
  • Optional staging. gg avoids using the staging area to save on typing and mistakes. However, gg takes great care to avoid perturbing the staging area, so for more advanced commits, you can keep using the same Git commands you're used to.
  • Works with existing Git tools. You can use or not use gg as much as you want in your workflow. gg is just a wrapper for the Git CLI, so it works with any hooks or custom patches to Git that your project may use. You can see the exact Git commands gg runs by passing in --show-git.

Learn more at gg-scm.io and talk with us on Discord.

Getting Started

Read the installation guide for the most up-to-date information on how to obtain gg. To build from source, follow the instructions in CONTRIBUTING.md.

License

Apache 2.0. This is not an official Google product.

gg depends on golang.org/x/sys, which is released under a BSD license.

Owner
Comments
  • Renamed file in working copy has issues on Git 2.11

    Renamed file in working copy has issues on Git 2.11

    Really a bug in a semi-old version of Git, but documenting in case I come up with a way to work around.

    Steps to Reproduce

    $ gg init
    $ touch foo.txt
    $ gg add .
    $ gg commit -m "first"
    $ mv foo.txt bar.txt
    $ gg add bar.txt
    $ gg status
    

    (This was caught by the regression test for #44, so you can trigger this with vgo test -run=TestStatus_RenamedLocally ./cmd/gg with Git 1.11 installed.)

    Expected Behavior

    status succeeds with:

    A bar.txt
    ! foo.txt
    

    Actual Behavior

    status exits with:

    gg: read status entry: unexpected EOF
    

    Amazingly, git status --porcelain produces:

     R foo.txt
    

    Notice that this is (space)R code, and the name is the source instead of the destination.

    Version Info

    gg built from source at 0eac45f8e010edcc289c22bc7a27875662e8e2a1 on 2018-07-14T22:13:58Z
    go: go1.10.3 gc linux/amd64
    git version 2.11.0
    
  • pull/clone should create & update local branches for any remote branches

    pull/clone should create & update local branches for any remote branches

    To make gg update and other commands that would want to use remote branches work regularly, I want gg pull and gg clone to create local branches (refs/heads/foo) for any remote branch (refs/remotes/origin/foo) with the upstream pointing to the remote branch. If multiple remotes have the same branch name, the one for the "origin" remote wins, otherwise the branch is not created. After a successful pull, for every existing local branch that has an upstream pointing to the pulled remote and no diverging commits will be fast-forwarded. This includes the branch pointed to by HEAD: if this is the case, then the working copy will be placed in detached HEAD state at the same commit.

  • Sort branches by last commit

    Sort branches by last commit

    Frequently, it's useful to show branches in order of how stale they are, not in alphabetical order. Perhaps this should be flag-guarded, but I'd definitely prefer this view of things.

  • gg push -f does not work well with different push URL

    gg push -f does not work well with different push URL

    Since gg push -f uses git push --force-with-lease, it can get confused if the pushed refs are not present as remote tracking branches. I'm not sure how to fix this, but it is definitely clunkier than I'd like.

    Steps to Reproduce

    $ gg clone https://github.com/example/foo.git foo
    $ cd foo
    $ git remote set-url --push origin ssh://[email protected]/myuser/foo.git
    $ gg branch feature
    $ gg push -create
    # hack hack hack
    # also change remote ref
    $ gg commit -amend
    $ gg push -f
    $ gg push -f
    

    Expected Behavior

    gg push succeeds.

    Actual Behavior

    gg push exits with:

    To ssh://github.com/myuser/foo.git
     ! [rejected]        1234deadbeef1234 -> feature (stale info)
    error: failed to push some refs to 'ssh://[email protected]/myuser/foo.git'
    gg: run git push: exit status 1
    

    Version Info

    gg built from source at 3ec7b3fe496c5a79481f0dccd166087319454fa2 on 2018-05-22T14:57:58Z
    go: go1.10.2 gc linux/amd64
    git version 2.17.0
    
  • go.mod: bump zombiezen.com/go/sqlite from 0.5.0 to 0.6.0

    go.mod: bump zombiezen.com/go/sqlite from 0.5.0 to 0.6.0

    Bumps zombiezen.com/go/sqlite from 0.5.0 to 0.6.0.

    Release notes

    Sourced from zombiezen.com/go/sqlite's releases.

    0.6.0

    Added

    • Added back the session API: Session, ChangesetIterator, Changegroup, and various functions. There are some slight naming changes from the crawshaw.io/sqlite API, but they can all be migrated automatically with the migration tool. (#16)

    Changed

    • Method calls to a nil *sqlite.Conn will return an error rather than panic. (#17)

    Removed

    • Removed OpenFlags that are only used for VFS.

    Fixed

    • Properly clean up WAL when using sqlitex.Pool (#14)
    • Disabled double-quoted string literals.
    Changelog

    Sourced from zombiezen.com/go/sqlite's changelog.

    0.6.0 - 2021-08-15

    Added

    • Added back the session API: Session, ChangesetIterator, Changegroup, and various functions. There are some slight naming changes from the crawshaw.io/sqlite API, but they can all be migrated automatically with the migration tool. (#16)

    Changed

    • Method calls to a nil *sqlite.Conn will return an error rather than panic. (#17)

    Removed

    • Removed OpenFlags that are only used for VFS.

    Fixed

    • Properly clean up WAL when using sqlitex.Pool (#14)
    • Disabled double-quoted string literals.
    Commits
    • 7612073 Add 0.6.0 to CHANGELOG
    • ed99db8 Disable double-quoted string literals
    • 2ed604b Add receiver nil checks for Conn methods
    • af0400e Bring session API back
    • c027cfe Bump version of golang.org/x/tools for migration command
    • 1c9dc13 Document #14 fix in CHANGELOG
    • e8e1652 Don't interrupt connections being returned to sqlitex.Pool
    • 96e0b6e Removed OpenFlags that are only used for VFS
    • See full diff in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • macOS packaging

    macOS packaging

    Binaries work pretty well for macOS, but packaging would be nice for keeping up-to-date. Seems like the two main distribution mechanisms here would be Homebrew and a native package. Probably need a man page, like in #49.

  • deb packaging

    deb packaging

    While shipping binaries is fine for Linux, it would also be convenient to have packaging for more convenient updates and management. This probably should include a minimal man page that points to the doc site and the built-in help command.

  • Windows support

    Windows support

    It would be nice to have Windows support. While I don't develop on Windows regularly, I feel confident enough in the test suite that if I start running Windows in CI (probably using AppVeyor) that it would work fairly well. Shipping Windows binaries would be easy at that point.

  • Renamed file added by gg causes status to crash

    Renamed file added by gg causes status to crash

    Steps to Reproduce

    EDIT 2018-07-08: Added reproduction steps.

    $ gg init
    $ touch foo.txt
    $ gg add .
    $ gg commit -m "first"
    $ mv foo.txt bar.txt
    $ gg add bar.txt
    $ gg status
    

    Expected Behavior

    status succeeds with:

    A bar.txt
    ! foo.txt
    

    Actual Behavior

    status exits with:

    gg: read status entry: invalid code ' ' 'R'
    

    Version Info

    gg built from source at 6a7382d3be3b54f4210b7a662f2e23250497ad35 on 2018-05-31T17:04:04Z with local modifications
    go: go1.10.2 gc linux/amd64
    git version 2.17.0
    
  • commit does not work in a subdirectory when files are removed

    commit does not work in a subdirectory when files are removed

    Don't have a repro for this one yet, but the :/: syntax doesn't seem to work in a subdirectory if the file is being removed in the working copy.

    Version

    gg built from source at c04b2e81151522d7494fba23de1a11640f6670bc on 2018-03-28T17:14:00Z
    go: go1.10 gc darwin/amd64
    git version 2.16.2.804.g6dcf76e118-goog
    
  • go.mod: bump gg-scm.io/pkg/git from 0.7.3 to 0.9.0

    go.mod: bump gg-scm.io/pkg/git from 0.7.3 to 0.9.0

    Bumps gg-scm.io/pkg/git from 0.7.3 to 0.9.0.

    Release notes

    Sourced from gg-scm.io/pkg/git's releases.

    0.9.0

    Version 0.9 adds a new package for interacting with remote Git repositories and expands the packfile package to handle random access.

    Added

    • A new packfile/client package enables downloading commits from and uploading commits to remote Git repositories. (#7)
    • The packfile.DeltaReader type is a flexible way of expanding a deltified object from a packfile.
    • The packfile.Undeltifier type decompresses objects from packfiles.
    • The packfile.Index type stores a packfile object ID lookup table that is nteroperable with Git packfile index files. (#12)
    • packfile.ReadHeader enables random access to a packfile.
    • *object.Commit and *object.Tag now implement BinaryMarshaler and BinaryUnmarshaler in addition to TextMarshaler and TextUnmarshaler. This is for symmetry with object.Tree.
    • object.Prefix allows marshaling and unmarshaling the "blob 42\x00" prefix used as part of the Git object hash.
    • The new *Git.Clone and *Git.CloneBare methods clone repositories.
    • git.URLFromPath converts a filesystem path into a URL.

    Changed

    • The githash package is now the home for the Ref type. This permits ref string manipulation without depending on the larger git package. git.Ref is now a type alias for githash.Ref.

    Removed

    • Removed the packfile.ApplyDelta function. The packfile.DeltaReader type performs the same function but permits more control over how it's used.

    Fixed

    • Ref.IsValid produces less false positives than before. (#16)

    0.8.1

    Version 0.8.1 updates the README.

    0.8.0

    Version 0.8 adds two new packages: object and packfile. These are pure Go implementations of the Git data structures and wire protocol, respectively. While most users will not interact with these packages directly, this provides better correctness guarantees, and makes it easier to directly read or write objects to a Git repository. Users that inspect commits with the git package now receive a higher fidelity data structure than before.

    Added

    • A new object package enables serializing and deserializing Git objects.
    • A new packfile package enables reading and writing the Git packfile format. (#4)

    Changed

    • *Git.CommitInfo and *Log.CommitInfo now return an *object.Commit instead of a *git.CommitInfo.
    • CommitOptions.Author, CommitOptions.Committer, AmendOptions.Author and AmendOptions.Committer are now type object.User instead of git.User.
    • *Git.Log now calls git rev-list | git cat-file instead of git log and parses the commits directly. One slight semantic change: if HEAD does not exist (an empty repository), then *Log.Close returns an error.
    • *TreeEntry.Mode now sets both os.ModeDir and os.ModeSymlink for submodules. This is more consistent with how Git treats these entries internally.
    • *TreeEntry.ObjectType now returns an object.Type instead of a string. It is otherwise functionally identical.

    Removed

    • git.CommitInfo has been removed in favor of object.Commit. The latter has mostly the same fields as the former, but does not contain a Hash field because the hash can be computed in Go.
    • git.User has been removed in favor of object.User. The latter is a string rather than a struct so as to pass through user information from Git objects verbatim.
    Changelog

    Sourced from gg-scm.io/pkg/git's changelog.

    0.9.0 - 2021-01-26

    Version 0.9 adds a new package for interacting with remote Git repositories and expands the packfile package to handle random access.

    Added

    • A new packfile/client package enables downloading commits from and uploading commits to remote Git repositories. (#7)
    • The packfile.DeltaReader type is a flexible way of expanding a deltified object from a packfile.
    • The packfile.Undeltifier type decompresses objects from packfiles.
    • The packfile.Index type stores a packfile object ID lookup table that is interoperable with Git packfile index files. (#12)
    • packfile.ReadHeader enables random access to a packfile.
    • *object.Commit and *object.Tag now implement BinaryMarshaler and BinaryUnmarshaler in addition to TextMarshaler and TextUnmarshaler. This is for symmetry with object.Tree.
    • object.Prefix allows marshaling and unmarshaling the "blob 42\x00" prefix used as part of the Git object hash.
    • The new *Git.Clone and *Git.CloneBare methods clone repositories.
    • git.URLFromPath converts a filesystem path into a URL.

    Changed

    • The githash package is now the home for the Ref type. This permits ref string manipulation without depending on the larger git package. git.Ref is now a type alias for githash.Ref.

    Removed

    • Removed the packfile.ApplyDelta function. The packfile.DeltaReader type performs the same function but permits more control over how it's used.

    Fixed

    • Ref.IsValid produces less false positives than before. (#16)

    0.8.1 - 2021-01-02

    Version 0.8.1 updates the README.

    [0.8.0][] - 2020-12-31

    ... (truncated)

    Commits
    • 3dc3bbb CHANGELOG: add 0.9 release notes
    • 080055d packfile/client: add note about supported schemes
    • 8dafa6b packfile/client: convert to local path separators
    • 78811bd .github: Bump actions/checkout from v1 to v2.3.4 (#20)
    • a73af34 .github: Bump actions/setup-go from v1 to v2.1.3 (#21)
    • 0fcb000 .github: fix dependabot commit message prefix
    • d6cbfaf .github: configure Dependabot
    • ffa8081 git: add Clone and CloneBare methods
    • 0b6a0f7 git: add URLFromPath function
    • e940895 packfile: add examples
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • SSH authentication doesn't appear to work on Windows

    SSH authentication doesn't appear to work on Windows

    Running:

    gg -show-git pull ssh://[email protected]/gg-scm/gg.git
    

    gives the output:

    gg: exec: git config -z --list
    gg: exec: git symbolic-ref --quiet HEAD
    gg: exec: git show-ref --head
    gg: exec: git ls-remote --quiet -- ssh://[email protected]/gg-scm/gg.git
    gg: git ls-remote "ssh://[email protected]/gg-scm/gg.git":
    [email protected]: Permission denied (publickey).
    fatal: Could not read from remote repository.
    
    Please make sure you have the correct access rights
    and the repository exists.
    

    However, running this works:

    git ls-remote --quiet -- ssh://[email protected]/gg-scm/gg.git
    
  • Support

    Support "-" as a target for gg update

    git checkout allows the user to switch back to the previous ref using a shorthand of git checkout - (docs). It can be implemented by rewriting the revision to @{-1}.

  • Add tests for amendedDiffStatus function

    Add tests for amendedDiffStatus function

    The amendedDiffStatus function at https://github.com/zombiezen/gg/blob/7a34fa369d22ac969419dd375a19c0ee031ebeec/cmd/gg/commit.go#L132 has no unit tests. It should have unit tests.

Expression evaluation engine for Go: fast, non-Turing complete, dynamic typing, static typing
Expression evaluation engine for Go: fast, non-Turing complete, dynamic typing, static typing

Expr Expr package provides an engine that can compile and evaluate expressions. An expression is a one-liner that returns a value (mostly, but not lim

Dec 30, 2022
Expression evaluation engine for Go: fast, non-Turing complete, dynamic typing, static typing
Expression evaluation engine for Go: fast, non-Turing complete, dynamic typing, static typing

Expr Expr package provides an engine that can compile and evaluate expressions. An expression is a one-liner that returns a value (mostly, but not lim

Dec 30, 2022
Fast, portable, non-Turing complete expression evaluation with gradual typing (Go)

Common Expression Language The Common Expression Language (CEL) is a non-Turing complete language designed for simplicity, speed, safety, and portabil

Jan 3, 2023
A terminal based typing test.
A terminal based typing test.

What A terminal based typing test. Installation Linux sudo curl -L https://github.com/lemnos/tt/releases/download/v0.4.0/tt-linux -o /usr/local/bin/tt

Dec 28, 2022
Command line tool for improving typing skills (programmers friendly)
Command line tool for improving typing skills (programmers friendly)

Command line tool for improving typing speed and accuracy. The main goal is to help programmers practise programming languages. Demo Installation Pyth

Jan 5, 2023
Fast, portable, non-Turing complete expression evaluation with gradual typing (Go)

Common Expression Language The Common Expression Language (CEL) is a non-Turing complete language designed for simplicity, speed, safety, and portabil

Dec 24, 2022
Typing test in your terminal
Typing test in your terminal

Typer Typing test in your terminal Installation go get github.com/maaslalani/typer/cmd/typer Usage To begin a typing test simply type typer. This wil

Jan 6, 2023
ptypes is a pointer-based box typing system for golang.

ptypes bypass go's type system through unsafe pointers the paradigm is to created a "boxed" type with .From and then use whatever types we want by ass

Aug 26, 2021
Clean-Swift source and test code auto-generator. It can save you time typing 500-600 lines of code.
Clean-Swift source and test code auto-generator. It can save you time typing 500-600 lines of code.

Clean-Swift source & test code auto generator Overview Run Output Basic Usage make config.yaml target_project_name: Miro // target project name copyri

Apr 13, 2022
JIS-US-practice - JIS-US switching practice typing game

JIS-US-practice JIS キーボードと US キーボードの切り替え練習のための CUI タイピングゲームです。 ルール 30 秒間で、表示された文

Jan 15, 2022
advancedsearch is a package to help peoples make search while typing "char" by "char" in Golang.

advancedsearch is a package to help peoples make search while typing "char" by "char" in Golang. Actually he has two main functions, CompareSingleWord and CompareMultipleWords.

Feb 2, 2022
Typistone - Typing races in your terminal

typistone (WIP) A typeracer clone for the terminal users. Usage go run . and th

Apr 12, 2022
Examples using the stomp package from git://github.com/gmallard/stompngo.git

stompngo_examples - A collection of examples for package stompngo Features Full demonstration of support for STOMP protocols: Protocol Level 1.0 Proto

Jan 22, 2021
Git with a cup of tea, painless self-hosted git service
Git with a cup of tea, painless self-hosted git service

Gitea - Git with a cup of tea View the chinese version of this document Purpose The goal of this project is to make the easiest, fastest, and most pai

Jan 2, 2023
Git with a cup of tea, painless self-hosted git service
Git with a cup of tea, painless self-hosted git service

Gitea - Git with a cup of tea View the chinese version of this document Purpose The goal of this project is to make the easiest, fastest, and most pai

Jan 2, 2023
Package git provides an incomplete pure Go implementation of Git core methods.

git Package git provides an incomplete pure Go implementation of Git core methods. Example Code: store := git.TempStore() defer os.RemoveAll(string(st

Oct 6, 2022
Git with a cup of tea, painless self-hosted git service
Git with a cup of tea, painless self-hosted git service

Gitea - Git with a cup of tea View the chinese version of this document Purpose The goal of this project is to make the easiest, fastest, and most pai

Jan 2, 2023
ReGit: A Tiny Git-Compatible Git Implementation written in Golang

ReGit is a tiny Git implementation written in Golang. It uses the same underlying file formats as Git. Therefore, all the changes made by ReGit can be checked by Git.

Oct 31, 2022
Watchtower for Git: automatically keep local Git repositories up to date with their remotes

CrowsNest Watchtower for Git: automatically keep local Git repositories up to date with their remotes. Configuration Flags --run-once or -r: Normally

Oct 30, 2022
A Git RPC service for handling all the git calls made by GitLab
A Git RPC service for handling all the git calls made by GitLab

Quick Links: Roadmap | Want to Contribute? | GitLab Gitaly Issues | GitLab Gitaly Merge Requests | Gitaly is a Git RPC service for handling all the gi

Nov 13, 2021