Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add git amend -i for a TUI #1019

Open
waylon-brown opened this issue Aug 7, 2023 · 7 comments
Open

Add git amend -i for a TUI #1019

waylon-brown opened this issue Aug 7, 2023 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@waylon-brown
Copy link

waylon-brown commented Aug 7, 2023

Description of the bug

For git amend the docs state that if I want to amend only some changes, I should add those to the staging area first.

I then expected there to be git amend -i - similar to git record -i - where I can choose with the TUI which changes to stage. This would be great so that I don't need to create a new commit each time I want to use the TUI to add only some changes.

Expected behavior

No response

Actual behavior

No response

Version of rustc

No response

Automated bug report

No response

Version of git-branchless

No response

Version of git

No response

@waylon-brown waylon-brown added the bug Something isn't working label Aug 7, 2023
@arxanas arxanas added enhancement New feature or request and removed bug Something isn't working labels Aug 14, 2023
@arxanas
Copy link
Owner

arxanas commented Aug 14, 2023

I agree that this would be useful, but I don't have any plans to work on it. You could try https://github.com/martinvonz/jj which does have a jj amend -i command.

@waylon-brown
Copy link
Author

waylon-brown commented Aug 14, 2023

Out of curiosity, why is it this isn't something that's planned? Is it too much work to integrate the existing TUI with amend? The TUI is really great - I think it'd make branchless a bit more intuitive to be able to use the TUI in other places since it's working with record.

Unfortunately jj is incompatible with my repo.

@waylon-brown
Copy link
Author

waylon-brown commented Aug 14, 2023

For ex. I can accomplish it w/ a couple commands, so I'm wondering if much of the internals could be reused here.

# git stage interactive
# Select changes in working directory to stage.
function gsi {
	# Using && \ to abort if exiting TUI.
	# Commit changes to keep
	git record -i -m "Temp." && \
	# Move changes back into working directory, which has prev-commited changes staged.
	git reset --soft HEAD~
}

# git amend interactive
alias gai="gsi && git amend"

@arxanas
Copy link
Owner

arxanas commented Aug 20, 2023

Out of curiosity, why is it this isn't something that's planned? Is it too much work to integrate the existing TUI with amend? The TUI is really great - I think it'd make branchless a bit more intuitive to be able to use the TUI in other places since it's working with record.

I just haven't had time to work on it. It should be reasonably straightforward if you want to work on it (but not trivial, because you have to synthesize the partial commit — you can see how it's done here:

let (selected, _unselected) = file.get_selected_contents();

).

For ex. I can accomplish it w/ a couple commands, so I'm wondering if much of the internals could be reused here.

You would also want to support the --merge and --reparent options that already exist for git amend.

@arxanas arxanas added the help wanted Extra attention is needed label Aug 20, 2023
@ghost
Copy link

ghost commented Aug 21, 2023

Thanks for the update - makes sense!

@ppwwyyxx
Copy link

Tried and found that jj amend -i by default includes untracked files. While git record -i does not.

As a git user, I'm more comfortable with the behavior of git record where untracked files are ignored.

@martinvonz
Copy link
Collaborator

We have jj-vcs/jj#323 for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants