Only if you specified -k / -keep-index: use git read-tree -reset -u $i_tree to "bring back" the stashed index as "changes to be committed" that also appear in the work tree. This removes all the untracked files, including untracked directories with -x (i.e., under -a mode), it also removes all the ignored files. Only if you specified -a or -u: run git clean -force -quiet -d (with -x if -a, or without it if -u). This sets the work tree back to the state in the HEAD commit. Run git reset -hard (with -q if you specified that too). (Of course, any partial changes you had staged before running git stash save -p, with git add or git add -p, are saved in commit i.) This clears out the "to be committed" state for everything, without changing anything else. Only if you specified -no-keep-index: run git reset (with no options at all, i.e., git reset -mixed). In essence, this leaves the work-directory with only those changes not stashed (specifically, those not in commit w everything in commit i is ignored here). "Reverse-patch" the work directory to remove the difference between HEAD and the stash. However, the script then takes several more steps that affect your work directory, depending on whether you're using -a, -u, -p, and/or -keep-index (and remember that -p implies -keep-index): This tree will be the tree for commit w.Īs its last stash-creation step, the script uses the tree just saved, the parent commit C, the index commit, and the root commit for untracked files if it exists, to create the final stash commit w. 2 In either case it writes a tree object from the temporary index. Without -p, it just diffs the work directory against the stashed index to find changed files. With -p, the script reads out the HEAD commit into the new staging area, then effectively 1 runs git add -i -patch, so that this index winds up with the patches you select. It does this with a temporary index file (basically, a fresh staging area). The stash script then saves your current work tree.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |