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 7072593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:49:39+00:00 2026-05-28T05:49:39+00:00

I presume git checkout . deletes all unstaged edits because — is optional in:

  • 0

I presume

git checkout .

deletes all unstaged edits because — is optional in:

git checkout [-p|--patch] [<tree-ish>] [--] [<paths>...]

This seems like something I might typo and there’s no “are you sure?” check, even in git-config as far as I can see. And since those changes haven’t ever been committed, they’re of course not in the reflog, so there’s no way to get them back.

Any way to make it prompt me before deleting my unstaged edits?
I’ve made a TextExpander snippet that rewrites git checkout . as #git checkout ., but hopefully there’s a better way.

  • 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-28T05:49:40+00:00Added an answer on May 28, 2026 at 5:49 am

    You can add an alias and convience yourself to use that instead. IE, create this shell script:

    #!/bin/sh
    
    if test "$1" = "." ; then
        echo -n "Are you sure (y/n)? "
        read ans
        if test "$ans" != "y" ; then
        echo "aborting"
        exit
        fi
    fi
    
    git checkout "$@"
    

    and call it git-safecheckout, and then alias it to something like co:

    # git config --global alias.co '!git-safecheckout'
    

    And the git co instead:

    # git co .
    git co .
    Are you sure (y/n)? n
    aborting
    
    # git co .
    Are you sure (y/n)? y
    #
    

    [Obviously there are a million ways you can feature-creep that shellscript]

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

Sidebar

Related Questions

first of all proper because I presume people will tell me that it is
I know this is possible to be done using javascript, and I presume I
I have a curl class, called Curl. Let's presume i have this code: $url
does anyone know how to do this? I presume it uses some sort of
So I presume this is a memory issue, here's the code: - (NSString *)giveMeAStringGoddammit
First of all I know that the title is general, but i presume that
Presume you have a class which passes all its current unit tests. If you
Let us presume I have the following object defined: var myObj = function(){ this.hello
I presume this is a configuration error somewhere, but I can't figure out where.
I presume this isn't a common problem, which makes it a bit more difficult

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.