![]() keep (disallowed) X means any state and U means an unmerged index.ġ. The following tables show what happens when there are unmerged entries: To be safe, it is also disallowed when there are That's why it isĭisallowed if there are both changes between the working tree and HEAD, and between HEAD and the target. If there could beĬonflicts between the changes in the commit we want to remove and the changes in the working tree we want to keep, the reset is disallowed. "reset -keep" is meant to be used when removing some of the last commits in the current branch while keeping changes in the working tree. That is why we disallow -merge option in this case. Index and the target and also between the index and the work tree, then it means that we are not resetting out from a state that a mergy operation left afterįailing with a conflict. Merge does not have local change wrt the index before it starts, and that it writes the result out to the work tree. Any mergy operation guarantees that the work tree file that is involved in the ![]() keep B C C "reset -merge" is meant to be used when resetting out of a conflicted merge. keep B C C working index HEAD target working index HEAD keep A C C working index HEAD target working index HEAD keep (disallowed) working index HEAD target working index HEAD Working index HEAD target working index HEAD Working tree, in state B in the index and in state D in HEAD. Working tree, in state B in the index, in state C in HEAD and in state D in the target, then "git reset -soft target" will put the file in state A in the For example, the first line of the first table means that if a file is in state A in the In these tables, A, B, C and D are some different states of a file. Git reset -option target to reset the HEAD to another commit (target) with the different reset options depending on the state of the files. The tables below show what happens when running: ![]() This means that git reset -p is the opposite of git add -p (see git-add(1)).Ĭommit to make the current HEAD. The chosen hunks are applied in reverse to the index. ![]() Interactively select hunks in the difference between the index and (defaults to HEAD). If a file that is different between the current commit and the given commit has local changes, reset is Reset the index to the given commit, keeping local changes in the working tree since the current commit, while updating working tree files without localĬhanges to what appears in the given commit. Resets the index to match the tree recorded by the named commit, and updates the files that are different between the named commit and the current commit in Any changes to tracked files in the working tree since are Matches the working tree and index to that of the tree being switched to. This leaves all your changed files "Changes to be This isĭoes not touch the index file nor the working tree at all, but requires them to be in a good order. Resets the index but not the working tree (i.e., the changed files are preserved but not marked for commit) and reports what has not been updated. The second and third forms with paths and/or -patch are used to revert selected paths in the index from a given commit, without moving ![]() If you want to undo a commit other than the latest on a branch, git-revert(1) is your friend. This command is useful if you notice some small error in a recent commit (or set of commits) and want to redo that part without showing the undo in the Sets the current head to the specified commit and optionally resets the index and working tree to match. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |