Guest User

Untitled

a guest
Jun 18th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. git add path/to/untracked-file
  2. git stash
  3.  
  4. git stash --include-untracked
  5. git stash -u
  6.  
  7. git add path/to/untracked-file
  8. git stash
  9.  
  10. git add -N path/to/untracked/file # note: -N is short for --intent-to-add
  11. git stash
  12.  
  13. path/to/untracked-file: not added yet
  14. fatal: git-write-tree: error building trees
  15. Cannot save the current index state
  16.  
  17. git add path/to/untracked-file
  18. git stash save "don't forget to un-add path/to/untracked-file" # stash w/reminder
  19. # do some other work
  20. git stash list
  21. # shows:
  22. # stash@{0}: On master: don't forget to un-add path/to/untracked-file
  23. git stash pop # or apply instead of pop, to keep the stash available
  24. git rm --cached path/to/untracked-file
  25.  
  26. git ls-files -o > files-to-untrack
  27. git add `cat files-to-untrack` # note: files-to-untrack will be listed, itself!
  28. git stash
  29. # do some work
  30. git stash pop
  31. git rm --cached `cat files-to-untrack`
  32. rm files-to-untrack
  33.  
  34. alias stashall='git ls-files -o > .gftu; git add `cat .gftu`; git stash'
  35. alias unstashall='git stash pop; git rm --cached `cat .gftu`; rm .gftu'
  36.  
  37. function unstashall(){git stash "${@:-pop}";git rm --cached `cat .gftu`;rm .gftu}
  38.  
  39. git add --intent-to-add path/to/untracked-file
  40.  
  41. git update-index --add --cacheinfo 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 path/to/untracked-file
  42.  
  43. $ git stash
  44. b.rb: not added yet
  45. fatal: git-write-tree: error building trees
  46. Cannot save the current index state
Add Comment
Please, Sign In to add comment