Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3441516
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:33:45+00:00 2026-05-18T08:33:45+00:00

I like the fine-grained commits that the git index allow, i.e. the staging of

  • 0

I like the fine-grained commits that the git index allow, i.e. the staging of individual files or even hunks through git add before the final commit. Unfortunately, sometimes after spending some time staging a particular commit, muscle-memory kicks in so that I git commit -a -m "msg". Then I either have to live with it, or jump through some reset or --amend hoops.

Is there a way for me to (ideally, globally) configure Git so that if I issue a git commit -a, it gets intercepted? Maybe a script asking me to confirm if I really want to commit all? I’ve thought about delegating the commit operation to a wrapper script (e.g., “gitcommit”), but do not think that will work very well as it does not stop me from doing a git commit -a -m "msg", which is the problem in the first place.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:33:46+00:00Added an answer on May 18, 2026 at 8:33 am

    Try pre-commit hooks:

    something like this (not tested)

    .git/hooks/pre-commit

    #!/bin/sh
    git diff-files --quiet    # check if the working directory have non-staged files
    DIRTY_WORKING=$?
    
    if [ ! $DIRTY_WORKING ] ; then        #  check if we are committing all files
       # list all files to be committed
       git diff-index --name-status --cached HEAD
    
       echo "Are you sure? (type YES to continue)"
       read VALUE
       [ "x$VALUE" != "xYES" ]
       exit $?
    fi
    exit 0
    

    You can find out the number of files to be committed using git diff-index --cached HEAD | wc -l. But I think I would leave this to yourself.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a formula like this which works fine on Excel/OOCalc applications: =SUMPRODUCT(--($Panels.$A$5:$A$6999=K$80);--($Panels.$B$5:$B$6999=K$81);INDEX($Panels.$C$5:$J$6999;0;MATCH(Voc;$Panels.$C$3:$J$3;0))) Since
I have an existing project that builds fine using my IDE. I'd like to
So what my code looks like.. Now the problem is that Everything is fine
I currently have a UINavigationController based application that works just fine. I'd like to
Is there any preexisting class that helps support add/remove EventListener operations? (kind of like
I have an html5 query that works fine like this: tx.executeSql('SELECT * FROM bdreminders
Ok, I know that serving media files through Django is a not recommended .
in php, something like this is fine: <?php if ( !$my_epic_variable = my_epic_function() ){
My code is something like the below. When theres 3 images everything is fine
The extension methods: Response.AsJson Response.AsXml works fine when calling it from the constractor like:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.