All of lore.kernel.org
 help / color / mirror / Atom feed
From: dev@kipras.org
To: git@vger.kernel.org
Subject: [FR] Allow `git stash create` to include untracked changes
Date: Sat, 26 Oct 2019 17:38:34 +0300	[thread overview]
Message-ID: <d02ddc0db596771820b0cfdfae5b1504@kipras.org> (raw)

Hello,

TL;DR:
Would it be possible for `git stash create` to include untracked changes 
(probably the same way `git stash push --include-untracked` does)?

---

I'm having some trouble with `git stash create`.

Currently, in my script (https://github.com/sarpik/git-backup), I 
essentially want to create a stash from untracked changes, create a 
branch from the stash, push the branch to a remote repository & pop the 
stash back, while keeping the backup branch. A remote stash, if you may.

I'm able to do this with regular `git stash push --include-untracked` 
and `git stash pop` commands, but there're some issues I've encountered 
and I believe that this is not the optimal solution.
This could be solved with `git stash create`, but it's unable to (as far 
as I know) create the stash with untracked/all changes.

Once again:
Would it be possible for `git stash create` to include untracked changes 
(probably the same way `git stash push --include-untracked` does)?

---

The issues I've so far encountered were:

Say I'm in an untracked directory. If I run `git stash push 
--include-untracked` and stay in this untracked directory, which 
actually does not exist anymore, and then run `git stash pop`, I get 
fatal errors and I'm unable to do anything else:

fatal: Unable to read current working directory: No such file or 
directory

(please see https://github.com/sarpik/git-backup/issues/10 and 
specifically, 
https://github.com/sarpik/git-backup/issues/10#issuecomment-546599631)

This could probably be solved by `cd`ing up until I'm inside the same 
directory where `.git/` folder is placed and only then running `git 
stash push --include-untracked` and `git stash pop`.

Even then, this approach still kind of sucks, because you're still 
temporarily stashing user's changes. I'd like to avoid this and `git 
stash create` seems like the perfect solution, if only it could include 
untracked changes.

Thank you very much - please let me know if there's anything else I 
could help with.

             reply	other threads:[~2019-10-26 14:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26 14:38 dev [this message]
2019-10-28  1:51 ` [FR] Allow `git stash create` to include untracked changes Junio C Hamano
2019-10-28 16:03   ` Kipras Melnikovas
2019-10-29  7:29   ` Johannes Schindelin
2019-10-31 13:40     ` Thomas Gummerer

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

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

  git send-email \
    --in-reply-to=d02ddc0db596771820b0cfdfae5b1504@kipras.org \
    --to=dev@kipras.org \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.