git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ninivaggi Mattia <mattia.ninivaggi@helsana.ch>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: [Feature- Request] Option to commit after checking out branch command is made
Date: Wed, 15 Nov 2017 15:27:18 +0000	[thread overview]
Message-ID: <670f44c0ac554f2faec5a6112376b015@MSSMAILP06.ads.hel.kko.ch> (raw)

Hey guys

Sometimes I tend to forget to commit changes before I checkout another branch and the following scenario happens (via cli on windows [with git bash]):

1. I checkout a branch, without having commited first
    > git checkout dev
2. I get this error message:
    > error: Your local changes to the following files would be overwritten by checkout:
    > // List of files
    > // ..
    > //
    > Please commit your changes or stash them before you switch branches.

But I would rather prefer a scenario like this:

1. I checkout a branch, without having commited first
    > git checkout dev
2. I get a message like this:
    > Your local changes to the following files would be overwritten by checkout:
    > // List of files
    > // ..
    > //
    > Would you want to commit first? (y/n))

IF y --> prompt for commit message and commit automatically
IF n --> display error message: "Please commit your changes or stash them before you switch branches"

This would be a faster/ more productive way to handle this error.

I think it wont be a big challenge, you just should put a message in the cli-tool when this error occurs and call the commit functionality if "y" is pressed. If you'd like I'll even consider doing it myself. If you have some documentation or some tipps on where to look for it.

Cheers

Ninivaggi Mattia

             reply	other threads:[~2017-11-15 15:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-15 15:27 Ninivaggi Mattia [this message]
2017-11-16  0:19 ` [Feature- Request] Option to commit after checking out branch command is made Junio C Hamano
2017-11-16 11:19   ` Ninivaggi Mattia
     [not found]   ` <CAGe7hXBPWvjaKZtz-Zn1az0HrCx=OpxGsghVJhLOBKMu3NJ2zA@mail.gmail.com>
2019-06-03  8:44     ` Fwd: " David Eisner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=670f44c0ac554f2faec5a6112376b015@MSSMAILP06.ads.hel.kko.ch \
    --to=mattia.ninivaggi@helsana.ch \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).