gg-scm / gg Goto Github PK
View Code? Open in Web Editor NEWGit with less typing
Home Page: https://gg-scm.io
License: Apache License 2.0
Git with less typing
Home Page: https://gg-scm.io
License: Apache License 2.0
sync is an alias for gg pull && gg evolve && gg rebase
. The flags should be some subset of the union of the flags for pull
, evolve
, and rebase
.
Add gg push -f
, does the same thing as git push -f
.
gg histedit
and gg rebase
pass through a bunch of output from git rebase
. While some of it is helpful, it's not organized particularly well. Especially after fixing #21, there's a bunch of output suggesting Git commands where there are more idiomatic gg counterparts that have more safeguards. It would be good to extract the same information, and then always run git rebase
with --quiet
. This will require a bit of research to see what git rebase
outputs under different circumstances (e.g. merge conflicts, finishing the rebase, running continue when there are unmerged paths).
There should be a rebase command. This is largely the same between git and Mercurial.
I know this is broken because I've examined the code, but I still need to create a test case.
$ gg init
$ mkdir foo
$ echo hello > foo/bar.txt
$ gg add .
$ gg commit -m "initial import"
$ echo goodbye > foo/bar.txt
$ gg commit -m "farewell"
$ gg branch -r HEAD~ feature
$ gg up feature
$ echo wutevs > foo/bar.txt
$ gg commit -m "meh"
$ gg up master
$ gg merge feature
Auto-merging foo/bar.txt
CONFLICT (content): Merge conflict in foo/bar.txt
Automatic merge failed; fix conflicts and then commit the result.
gg: run git merge: exit status 1
$ echo sup > foo/baz.txt
$ gg -show-git add foo
# various things
gg: exec: git add -N -- :(top, literal)foo/baz.txt
gg: exec: git add -- :(top, literal)foo/bar.txt
gg: exec: git rev-parse --show-toplevel
gg: exec: git status --porcelain -z -unormal -- :(top,literal)foo
gg: exec: git add -N -- :(top,literal)foo
gg: exec: git add -- :(top,literal)foo/bar.txt
gg version 0.5.1, built on 2018-05-31T21:55:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4
Occasionally, I need something like --ignore-all-space
or other lesser-used diff options. It would be good to add these.
gg version 0.4.1, built on 2018-04-18T23:18:54Z
go: go1.10 gc linux/amd64
git version 2.7.4
It would be good to have docs for how to use gg for each of the Gerrit workflow, shared GitHub repository workflow, and GitHub fork-and-pull workflow, especially since gg is rather opinionated about how to set up each of these things.
gg status
should use the colors configured for git status.
gg clone https://example.com/foo/bar.git
cd bar
git remote set-url --push origin https://example.com/foo/bar-fork.git
gg branch newbranch
gg push -create
touch foo.txt && gg add foo.txt && gg ci -m "did something random"
gg push
Ref newbranch is updated on https://example.com/foo/bar-fork.git
Fails with the following message:
gg: remote origin does not have ref refs/heads/newbranch
gg version 0.4.2, built on 2018-05-02T18:47:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4
gg rebase and gg histedit fill different roles: rebase should be reparenting, and histedit should be editing changes. Thus, running a histedit should not change the parent that the stack of changes is based on.
gg init
touch foo.txt
gg add foo.txt
gg ci -m "first commit"
gg branch foo
echo somechange > foo.txt
gg ci -m "this is a feature"
gg up master
echo upstreamchange > foo.txt
gg ci -m "life moves on"
gg up foo
gg histedit
# edit foo's change, finish rebase
Commit's parent is the first commit (the original base of the stack)
Commit's parent is the upstream's commit
gg version 0.4.0, built on 2018-04-18T14:34:41Z
go: go1.10 gc linux/amd64
git version 2.17.0.484.g0c8726318c-goog
Because I pulled in net/http
for gerrithook
, gg has gone from a ~3MiB binary to a ~6MiB binary. Not the worst thing, but certainly a lot of binary size for a little feature. ๐
Gerrit requires client workspace to have special commit-msg hook -- https://gerrit-review.googlesource.com/tools/hooks/commit-msg. It would be nice to add this commit-msg hook on clone either by auto-detecting or additional arg.
Introduced in 681332b
$ gg push -d master ssh://[email protected]/example/foo.git
fatal: No such remote 'ssh://[email protected]/example/foo.git'
Enumerating objects: 167, done.
... normal push output follows ...
Unlike push, which generally makes sense to push to the same branch, it is quite common to want to pull the upstream. Especially in conjunction with #15, this seems like more helpful behavior.
Admittedly, this is clearer in Mercurial than Git, since Mercurial can look for descendants without knowing a ref. Rebase could walk all of the local branches (refs/heads/*
) to find potential descendant lines, I suppose.
gg init
echo hello > foo.txt && gg add foo.txt
gg ci -m "first commit"
gg branch topic
echo hello > bar.txt && gg add bar.txt
gg ci -m "this is feature 1"
echo hello > baz.txt && gg add baz.txt
gg ci -m "this is feature 2"
gg up master
gg rebase -src=`git rev-parse topic` -dst=HEAD
A commit with baz.txt is created on top of the first commit.
No commit is created and rebase exits successfully
gg version 0.4.1, built on 2018-04-18T23:18:54Z
go: go1.10 gc linux/amd64
git version 2.7.4
Repro case:
gg histedit --continue # or one of the other options
Error message:
gg: usage: can't pass arguments with --continue
Currently, pull uses the same named ref as a source. It should use the upstream instead.
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.
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
A common scenario in Gerrit-based workflows is having a change cherry-picked into master and then needing to rebase the rest of your feature branch on the new changeset. In Mercurial land, this is called changeset evolution.
Right now, I'm manually aligning the beginning of the new changes and performing gg rebase -src=COMMIT -dst=master
on my topic branch. This can be automated by having gg sniff the Change ID lines from the commit.
I always miss the simplicity of hg cat
, and while I don't use it often, looking up the correct git cat-file
invocation is always painful. Bring on the cats!
It would be good to have gg have a mode to spit out a bash completion file. It seems that most modern shells (including zsh) can understand the bash completion language, so this should be sufficient.
The hg merge
command never creates a merge commit. The assumption is that you will run tests and make sure the merge was successful. gg merge
should follow the same tradition, but does not right now, since that is not Git's default behavior.
Just got bit by this: I'd like for mail to bail early (overridable by flag) if there are local changes in the working copy, so that then I have the chance to amend the commit.
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.
I just recently hit an issue where the implicit --fork-point
messed up a rebase where I had set the upstream to a local branch and done a dance with dependent feature branches.
$ gg init
$ touch foo.txt && gg add foo.txt && gg commit -m "first"
$ touch bar.txt && gg add bar.txt && gg commit -m "second"
$ gg branch feature
$ gg up master
$ git reset --hard HEAD~
HEAD is now at f950f8a first
$ touch baz.txt && gg add baz.txt && gg commit -m "third"
$ gg up feature
Branch 'feature' set up to track local branch 'master'.
$ gg rebase -dst=master
The second commit is rebased on top of the third commit.
The feature
branch is forcibly reset to master
.
First, rewinding head to replay your work on top of it...
$ git rev-parse master feature
f1dd4c2894062a83ebae024077922315f410f00a
f1dd4c2894062a83ebae024077922315f410f00a
gg built from source at 3ec7b3fe496c5a79481f0dccd166087319454fa2 on 2018-05-22T14:57:58Z
go: go1.10.2 gc linux/amd64
git version 2.17.0
gg init
touch foo.txt
gg add .
Adds all unignored files.
gg: file "/path/to/repo" is outside the working copy; cannot be added
gg version 0.4.2, built on 2018-05-02T18:47:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4
The Git CLI has branch --set-upstream-to
, but AFAICT no direct way of querying what a branch's upstream is set to. Since this is a pretty fundamental concept, it would be good to have a command that directly pokes at the config settings.
Tags should likely be the exception to the "only pull one ref" rule, since it's laborious to go find out what all of the new tags are.
(rebase is likely affected too, since this appears to be a problem with calling git merge-base --fork-point
with a non-ref argument.)
gg init
touch foo.txt && gg add foo.txt && gg ci -m "initial import"
echo foo > foo.txt && gg ci -m "second change"
gg histedit HEAD~
Editor opens rebase plan with second change.
gg histedit exits with error:
fatal: No such ref: 'HEAD~2'
gg: run git merge-base: exit status 128
gg version 0.4.1, built on 2018-04-18T23:18:54Z
go: go1.10 gc linux/amd64
git version 2.7.4
While I don't use backout every day, looking up the correct git invocation is painful. Add gg backout
.
Maps 1:1 with git log --reverse
.
$ gg merge origin/master
# experience merge conflicts
$ gg add conflict.txt
$ gg commit
gg opens editor with merge commit message.
fatal: cannot do a partial commit during a merge.
gg: run git commit: exit status 128
gg built from source at 3ec7b3fe496c5a79481f0dccd166087319454fa2 on 2018-05-22T14:57:58Z
go: go1.10.2 gc linux/amd64
git version 2.17.0
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.
$ 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
gg push
succeeds.
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
gg built from source at 3ec7b3fe496c5a79481f0dccd166087319454fa2 on 2018-05-22T14:57:58Z
go: go1.10.2 gc linux/amd64
git version 2.17.0
Since I've already hit some git compatibility issues during development, it would be good to:
I'd like to replicate the hg revert
functionality of keeping a backup file for any reverted file. There is nothing in git checkout
that does this, so likely gg revert
would have to roll its own behavior.
I'd like to have an online version of the reference documentation, not just in-tool. The build process should be automated, so that a new copy is published with each release. Something with GitHub pages is probably the right approach.
It would be nice to replicate the Mercurial uncommit command. Synopsis:
gg uncommit [FILE [...]]
uncommit part or all of a local commit
Running gg uncommit
without any arguments should behave like git reset --soft HEAD~
.
Running gg uncommit
with arguments should do something like:
# Update index with previous state of files, but don't modify the working tree.
git reset -q HEAD~ -- FILE1 FILE2 ...
# Now roll back the HEAD ref.
git reset --soft HEAD~
Tricky part will be to ensure this works on the first commit as well: this shouldn't introduce any bugs like #30.
/cc @ianthehat, who requested this feature.
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.
Based on a suggestion by Austin Clements to never use commit --amend
during a rebase, I'd like to enable the same flow in gg. The problem is that in order for this to work, the working copy must be clean and the index must include all the necessary changes: gg add
specifically does not add new changes to the index.
gg init
touch foo.txt && gg add foo.txt && gg ci -m "initial commit"
echo "mychange" > foo.txt && gg ci -m "second commit"
gg histedit HEAD~
# edit abcdef second commit
echo "my new change" > foo.txt
gg histedit -continue
The rebase proceeds and completes successfully.
histedit
exits with failure.
gg version 0.4.1, built on 2018-04-18T23:18:54Z
go: go1.10 gc linux/amd64
git version 2.17.0.484.g0c8726318c-goog
There should be merge and resolve commands. Merge should be a git merge --no-ff
.
Add an rm -r
flag, which maps 1:1 with git rm -r
.
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
status succeeds with:
A bar.txt
! foo.txt
status exits with:
gg: read status entry: invalid code ' ' 'R'
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
Probably better to add a gg resolve
command.
gg init
echo Hello > foo.txt
gg add foo.txt
gg diff
Shows the staged diff
fatal: bad revision 'HEAD'
gg: run git diff: exit status 128
gg version 0.4.2, built on 2018-05-02T18:47:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4
Steps to reproduce:
$ gg init
$ echo foo > foo.txt
$ gg add foo.txt
$ gg commit -m "mumble"
$ gg commit --amend
Expected behavior:
Editor opens with commit message.
Actual behavior:
Failure with output:
gg: nothing changed
Now that gg has logic for detecting descendants, it would be good to use this in gg mail
's destination inference when working on a topic branch.
# existing gerrit clone
gg branch myfeature
# hack
gg ci -m "first commit"
# hack
gg ci -m "second commit"
gg mail -r HEAD~
gg mail
infers destination as master.
gg mail
exits because it can't infer destination since HEAD~
is not a ref.
gg version 0.4.2, built on 2018-05-02T18:47:34Z
go: go1.10.1 gc linux/amd64
git version 2.7.4
There should be a special case of push that pushes a Gerrit change, optionally setting the parameters detailed in Uploading Changes
$ gg init
$ touch foo.txt && gg add foo.txt
$ gg commit -m "first commit"
Commit succeeds silently (no output).
Commit succeeds with:
fatal: Not a valid object name MERGE_HEAD
gg version 0.5.0, built on 2018-05-31T00:37:28Z
go: go1.10.1 gc linux/amd64
git version 2.17.0
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.