git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [FR] Allow `git stash create` to include untracked changes
@ 2019-10-26 14:38 dev
  2019-10-28  1:51 ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: dev @ 2019-10-26 14:38 UTC (permalink / raw)
  To: git

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-10-31 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-26 14:38 [FR] Allow `git stash create` to include untracked changes dev
2019-10-28  1:51 ` Junio C Hamano
2019-10-28 16:03   ` Kipras Melnikovas
2019-10-29  7:29   ` Johannes Schindelin
2019-10-31 13:40     ` Thomas Gummerer

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 NNTP newsgroup(s).