chshersh / zbg Goto Github PK
View Code? Open in Web Editor NEW✨ Zero Bullshit Git
License: Mozilla Public License 2.0
✨ Zero Bullshit Git
License: Mozilla Public License 2.0
This command should:
zbg switch
with the default arguments.zbg commit
ran a git add .
.
This isn't really considered good practice because there can be temp, test or unfinshed files that need to manually be unstaged which can be quite tedious.
Solution: Implement a separate zbg add <files>
command, allowing the commit command to function as just that.
I think I don't need it anymore, but when anyone starts using git
, a thing that we would really want is a Ctrl+Z, haha 😁
So the idea would be to have a zbg undo
command that looks at the current state of git
and aborts it when it's supported, or undoes the commit otherwise.
git rebase --abort
(grba
)git merge --abort
(gma
)git cherry-pick --abort
--abort
git reset --soft HEAD~1
Not sure what needs to be done. I guess, mostly updating the compiler version on CI:
Lines 18 to 19 in 8aa3242
(and fixing all the breakages)
This should open default editor
Seems like zbg do not take in account by global .gitignore
file
.DS_Store
.vscode/
*.code-workspace
Take a look
❯ zbg status
added .DS_Store | Bin 0 -> 6148 bytes
added .github/.DS_Store | Bin 0 -> 6148 bytes
added .vscode/settings.json | 6 ■■■■■■
added .vscode/tasks.json | 50 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
added other/.DS_Store | Bin 0 -> 6148 bytes
added other/join-service/.vscode/settings.json | 6 ■■■■■■
added src/.DS_Store | Bin 0 -> 6148 bytes
added src/Context/.DS_Store | Bin 0 -> 6148 bytes
added src/Context/Individual/.DS_Store | Bin 0 -> 6148 bytes
added src/Context/Individual/Connection/.DS_Store | Bin 0 -> 6148 bytes
added src/Context/Individual/Domain/.DS_Store | Bin 0 -> 6148 bytes
added src/Core/.DS_Store | Bin 0 -> 6148 bytes
added tests/.DS_Store | Bin 0 -> 6148 bytes
added union-server.code-workspace | 39 ■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■
and
union-server on master via 🐳 desktop-linux via λ lts-20.26
❯ git status
On branch master
Your branch is up to date with 'origin/master'.
nothing to commit, working tree clean
Some project are still using "master", it can be configured anyway.
git rev-parse --abbrev-ref origin/HEAD
Current behaviour: empty string
❯ zbg status
I'm wondering if this would be worth adding. I know that I tend to use git commit --amend
a lot when working on projects if my commits tend to be related somehow before pushing to some remote branch. This is somewhat destructive because it changes the previous commit but in that case we could just hide it behind a prompt if we're worried about that.
One thing that I miss with zbg
is a way to format the commit message like with the cmt
Haskell tool.
zbg new
already goes in the direction of having some convention for branch names (with the user.login
prefix), I think it would be good to go one step further with commit messages. This could be totally optional:
.cmt
file is defined locally, use that file as a template for the commit message (see the cmt demo).cmt
file then let the user type a regular commit message.Currently, messages for the zbg stash
command are not escaped. This can result in weird behaviour.
Line 125 in 42bdb5c
Probably, the quote_command function from Unix
should be used.
A new command zbg clone
to type the owner and repository name easier.
$ zbg clone tool-sync
🐚 git clone [email protected]:chshersh/tool-sync.git
$ zbg clone BurntSushi/ripgrep
🐚 git clone [email protected]:BurntSushi/ripgrep.git
Behaviour:
Currently, zbg
supports only the -f
flag for forceful actions:
Line 17 in 7b44863
However, it would be nice to support --force
as well. Unfortunately, it looks like Core.Command
doesn't support specifying multiple aliases for the same flag (or maybe I just haven't found it). But it would be nice to have it! (ideally, without rewriting the CLI parser to a different library).
https://ocaml.org/p/core/v0.12.3/doc/Core/Command/Param/index.html
Currently, zbg
calls a separate process basename
to extract the branch name.
Lines 13 to 14 in 7b44863
However, this is unnecessary as it could be implemented as a pure function (maybe a filepath library already has it?).
The plan:
basename
into a separate functionTo make sure that escaping works as expected
Lines 66 to 71 in b9be80f
Hi @chshersh, really good tool. Thanks for the effort and style on zbg.
I'm using it and found a bug when running status from a different path than root (containing the .git folder)
→ $ zbg status
modified .gitignore | 1 ■
modified dune | 2 ■■
modified dune-project | 2 ■■
modified e2e/rescript-v9-JSX3/bsconfig.json | 3 ■■■
modified e2e/rescript-v9-JSX3/package.json | 3 ■■■
modified e2e/rescript-v9-JSX3/yarn.lock | Bin 87888 -> 64994 bytes
added packages/css/bsconfig.json | 8 ■■■■■■■■
→ $ cd bin
→ $ zbg status
modified .gitignore | 0 <unable to match file>
modified dune | 0 <unable to match file>
modified dune-project | 0 <unable to match file>
modified e2e/rescript-v9-JSX3/bsconfig.json | 0 <unable to match file>
modified e2e/rescript-v9-JSX3/package.json | 0 <unable to match file>
modified e2e/rescript-v9-JSX3/yarn.lock | 0 <unable to match file>
So users could see git
commands before actually running them.
This would probably require rewriting the whole project.
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.