Git - How do you stash an untracked file

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have changes to a file, plus a new file, and would like to use git stash to put them away while I switch to another task. But git stash by itself stashes only the changes to the existing file; the new file remains in my working tree, cluttering up my future work. How do I stash this untracked file?

Answers

http://blog.icefusion.co.uk/git-stash-can-delete-ignored-files-git-stash-u/ http://blog.icefusion.co.uk/git-stash-can-delete-ignored-files-git-stash-u/

Add (git add) the file and start tracking it. Then stash. Since the entire contents of the file are new, they will be stashed, and you can manipulate it as necessary.

As of version 1.7.7 you can use git stash save -u to stash untracked files without staging them.

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/835501/how-do-you-stash-an-untracked-file

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils