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

Amend commit support #999

Closed
domenkozar opened this issue Apr 19, 2019 · 5 comments
Closed

Amend commit support #999

domenkozar opened this issue Apr 19, 2019 · 5 comments
Labels

Comments

@domenkozar
Copy link

There are some checks that are automatic. We're using brittany (Haskell source formatter) and my workflow goes always as following:

  1. make changes
  2. commit
  3. pre-commit failed
  4. amend commit
  5. commit again

I was wondering if 3 and 4 could be merged into pre-commit showing the diff and then asking to amend it?

@asottile
Copy link
Member

It could, however pre-commit currently doesn't do either of the two things:

  • modify the staging area
  • have interactivity

The second is difficult as well because git hooks are not handed a tty and would have to (unreliably) fish one out of /dev/tty (not even sure this is possible on windows)

I use:

git add -u && !!

quite often fwiw

@domenkozar
Copy link
Author

I guess interactivity was a stretch goal, I would be happy with just "accept the output" as there's nothing one can really do against autoformatter.

I presume modifying the staging area is doable?

@asottile
Copy link
Member

one could SKIP / etc. to bypass the auto formatter.

pre-commit takes a strong stance on not modifying the staging area -- here's more reading on that subject: #747 #806 #879

@domenkozar
Copy link
Author

Alright :)

@asottile
Copy link
Member

thanks for the issue though! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants