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

Commit --amend and --no-edit #35

Closed
gabrielseibel1 opened this issue Apr 20, 2020 · 6 comments
Closed

Commit --amend and --no-edit #35

gabrielseibel1 opened this issue Apr 20, 2020 · 6 comments
Labels
enhancement New feature or request

Comments

@gabrielseibel1
Copy link

Hi. I'm trying to implement a simple git commit --amend --no-edit using go-git. I noticed the compatibility table states commit is supported, without any notes on specific flags. Are the flags --amend and --no-edit implemented and I'm missing something? If this is not currently possible with this module, maybe the documentation could state it upfront.

@mcuadros
Copy link
Member

git has two levels of abstraction, you can perfectly do this task with the plumbing part, that's why this commit is mark as supported.

What is not supported is a CommiOption with the Amend flag, we go-git can not aim to support all the porcelain features, socially this kind that is very user-oriented.

Anyway, PRs are welcome.

@mcuadros mcuadros added the enhancement New feature or request label Apr 23, 2020
@pmoody-
Copy link

pmoody- commented Jan 11, 2021

Hi,

I find myself wanting to do something similar. Are there any examples of using the low-level plumbing interface(s) for doing sort of commit re-writing?

Cheers

@john-cai
Copy link
Contributor

john-cai commented Jan 3, 2022

#438

@sosheskaz
Copy link

sosheskaz commented Aug 5, 2022

This is probably an ugly solution, but you can approximate the effect of amend by:

  1. Set toAmend to the commit you would like to amend.
  2. Set parent to the parent of toAmend
  3. Checkout toAmend
  4. Perform a soft reset to toAmend's parent.
  5. Make any modifications to the tree.
  6. Perform a commit.
  7. Reset any additional plumbing.References.

Worked well for my purposes, but I'm also not really dealing with branches, so YMMV with references.

@gabrielseibel1
Copy link
Author

Hi. OP here. I've no more interest in this effort, I've left the company where I was trying to work that out. Should I close this issue?

@pjbgf
Copy link
Member

pjbgf commented Aug 5, 2023

Closing as done - #438.

@pjbgf pjbgf closed this as completed Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants