how to contribute to Lazygit Custom Commands Compendium?
Describe the bug
I wasn't able to push a commit containing a custom command in the Lazygit Wiki
To Reproduce
- I cloned the wiki repo:
git clone https://github.com/jesseduffield/lazygit.wiki.git - I added a new section with the command I'd like to share
- I tried to push my commit:
git push origin master - The push failed since the password authentication was removed, however I cannot push via ssh keys as well.
Sorry for the stupid question, there is for sure something basilar I'm missing. How can I proceed? If you prefer I can copy/paste the commit content here and you decide if include in the wiki or not :)
That's because you don't have write permissions to the master branch in the original repository.
The usual way of proposing changes is forking the repository, creating changes in the fork, push them, and then opening a pull-request which is reviewed and discussed.
What is the command you wished to add to the wiki?
Thank you for the rapid answer :)
If I understood correctly the Wiki is into another repository, right? But I wasn't able to find it such that I could fork it...
I implemented a simple command to show the tag annotation in the tag panel:
customCommands:
- key: 'a'
context: 'tags'
command: "git for-each-ref refs/tags/{{.SelectedTag.Name}} --format='%(contents)'"
output: popup
outputTitle: "Tag Annotation"
description: "Show Tag Annotation"
For me is quite useful, maybe someone else can find this useful too.
Just tagging along here.
I was also attempting to contribute to the compendium, but didn't have any luck when forking this repo.
If anyone is interested, I've attempted to recreate Magit's "spin-off" function in lazygit
customCommands:
- key: 'S'
description: 'Spinoff HEAD to new branch and reset to upstream'
command: >
sh -c '
set -e;
if ! git diff --quiet HEAD; then
git stash push --include-untracked --message "lazygit-spin-off-temp";
STASH_CREATED=true;
else
STASH_CREATED=false;
fi;
original_commit=$(git rev-parse HEAD);
git reset --hard @{u};
git checkout -b "{{.Form.NewBranchName}}" "$original_commit";
if [ "$STASH_CREATED" = true ]; then
git stash pop;
fi;
'
context: 'localBranches'
loadingText: 'Spinning off branch...'
prompts:
- type: 'input'
title: 'Enter name for spin-off branch:'
key: 'NewBranchName'
@atoftegaard-git We have this as built-in functionality in lazygit now, as of 0.50. It's a bit more powerful than yours, because it gives you the choice of keeping the new branch stacked on top of the old one (like your command does), or recreating it based on main, which is what I usually need.
@atoftegaard-git We have this as built-in functionality in lazygit now, as of 0.50. It's a bit more powerful than yours, because it gives you the choice of keeping the new branch stacked on top of the old one (like your command does), or recreating it based on main, which is what I usually need.
Ah okay, I had been running 0.49 for a while and couldn't find anything online about this feature being in LazyGit.
But awesome, that means I won't have to maintain an inferior way to do it.
@stefanhaller what about the original question? how one can contribute to the Custom Command Compendium? where is the repository to fork?
thanks in advance :)
@stefanhaller what about the original question? how one can contribute to the Custom Command Compendium? where is the repository to fork?
The repository URL is mentioned on the wiki page (bottom right, under "Clone this wiki locally"). That's all I know; I don't think you can create PRs for that repo, and I'm not sure how permissions to push to the master branch are handled. This might be something for @jesseduffield to answer.
Thanks for the answer. This was actually my starting point, I tried to contribute to the wiki by updating the URL mentioned in the wiki page but obviously I failed.
I also tried to follow the suggestions reported here but I failed. I guess I'll give up unless someone suggests how to proceed...
Thanks again for the support.
@pdicerbo I just learned from Jesse that the Wiki used to be editable at some point (as I guess is common in open source repos), but then it was abused by scammers and had to be closed for that reason.
Since github doesn't provide a way to create PRs for the wiki repo, the best we can do right now is that you create an issue which contains a patch against the wiki repo, and one of the maintainers applies it. A bit cumbersome for all of us, but should be doable if it only happens occasionally, and I can't think of a better way.
Thanks for your answer! Still I can't find the path to the wiki repo such that I can create the issue. I guess I'll try to create the issue here, we'll see if the patch will sounds interesting.