Skip to content

Amend commit #306

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

Closed
JavierSegoviaCordoba opened this issue Oct 11, 2021 · 8 comments · Fixed by #331
Closed

Amend commit #306

JavierSegoviaCordoba opened this issue Oct 11, 2021 · 8 comments · Fixed by #331
Assignees
Labels
good first issue Good for newcomers status: pinned Should not be labeled as stale type: feature New feature or feature request type: question Further information is requested

Comments

@JavierSegoviaCordoba
Copy link

Is it possible to amend the commit?

@JavierSegoviaCordoba JavierSegoviaCordoba added the type: question Further information is requested label Oct 11, 2021
@EndBug
Copy link
Owner

EndBug commented Oct 11, 2021

As of now, it's not possible, but it's a feature that could be added!

@EndBug EndBug self-assigned this Oct 11, 2021
@EndBug EndBug added good first issue Good for newcomers type: feature New feature or feature request status: pinned Should not be labeled as stale labels Oct 11, 2021
@JavierSegoviaCordoba
Copy link
Author

JavierSegoviaCordoba commented Oct 13, 2021

GitHub Actions has a weird behavior when it is triggered by pull_request. The latest commit is a temporal merge commit (which later disappears), so if you amend the commit, that merge one will be used.

Should be great if you take care of this so you can just drop the last one and then amend if the action is triggered by pull_request and/or add an input flag.

@EndBug
Copy link
Owner

EndBug commented Oct 13, 2021

I'm planning to allow you to edit the arguments of the git commit command (also getting rid of the signoff input).
While resetting to the previous commit can be done I'd prefer not to add something that will probably need some tuning anyway because of edge cases: I think it's better if you reset to the previous commit manually before running the action, since it's a more complex use case.

@JavierSegoviaCordoba
Copy link
Author

I was doing some tries and reset the head to remove the latest commit that was not working correctly on GitHub Actions, not sure if I was doing something wrong because I am not a git expert. Can you help me take a look to it?

I tried:

  • git reset --hard HEAD^
  • git reset --soft HEAD~1

For some reason, all commits in that PR are disappearing because everything was amended to the latest main commit used by the pull request branch. Something so weird.

The use case is:

Renovate or dependabot create a PR, then pull_request is triggered, so I read the commit, I add the commit (it contains the updates) to CHANGELOG.md, and later I want to amend these changes to the commit created by Renovate, and push.

What is the workaround should I use?.

@EndBug
Copy link
Owner

EndBug commented Oct 14, 2021

To be honest, I've never had to amend commits in pull requests, so I don't really know how GitHub handles PR commits. Also, dependabot might mess up the commit history of its branches, since it always force-pushes when it updates a PR: it's the intended behavior for Dependabot's typical use case, but I don't know how it affects the commit history of the branch...

@EndBug
Copy link
Owner

EndBug commented Dec 3, 2021

@all-contributors please add @JavierSegoviaCordoba for their idea

@allcontributors
Copy link
Contributor

@EndBug

I've put up a pull request to add @JavierSegoviaCordoba! 🎉

@EndBug
Copy link
Owner

EndBug commented Jan 20, 2022

This feature has been added in v8.0.0 (also v8 and latest). Thanks for your issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers status: pinned Should not be labeled as stale type: feature New feature or feature request type: question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants