Loading tutorials
git reset works by moving a pointer. Before you can predict what it does, you need a precise picture of what that pointer is and what it points at. This chapter builds that picture: what a commit contains, why a branch is only a label, and what HEAD is. The next chapter adds the index and the work6 min readgit init, git add, git commit, git status, and git log, and that you know what a branch is. It builds the mental model that the rest of the tutorial relies on. Every git reset mode is a statement about which of these three areas to change, so you need to 7 min readgit reset: what it changes, in what order, and where it stops. It assumes you can use git init, add, commit, status, and log, that you know what a branch is, and that you are comfortable in a terminal. It also assumes you have read the previous c7 min readgit log, git status, and git commit, and that you know a branch is a movable name for a commit. You should also know that HEAD normally points at your current branch. The later chapters cover what each reset mode does to the index and working directory. This 7 min readgit init, add, commit, status, and log, and that you know what a branch is. It also assumes you know the three areas Git tracks: the commit that HEAD points to, the index (staging area), and the working directory. git reset --soft is the mildest of the 7 min readgit reset. It assumes you can use init, add, commit, status, and log, that you know what a branch is, and that you read the previous chapter on --soft. You should also remember the three areas Git tracks: the HEAD commit, the index (also called t7 min readgit reset --hard is the widest of the three reset modes. It moves the current branch, makes the index match the new commit, and overwrites tracked files in the working directory to match as well. It is also the only common reset mode that can destroy uncommitted work.6 min readgit add, git commit, git status, and git log. It also assumes you know what the index (staging area) and the working directory are. If those terms are fuzzy, review the chapter on the three areas first.6 min readgit reset for most: undoing a commit, unstaging files, squashing local commits, and discarding changes. It assumes you know init, add, commit, status, and log. It also assumes you know what the three areas are (the HEAD commit, the index, an6 min read--soft, --mixed, and --hard do, and that you can read git log --oneline output. A reset that moved your branch to the wrong place feels destructive, but in most cases the old commits are still in the repository. You only need to find them again. Git gives y6 min read--soft, --mixed, and --hard change, and that you can read git status and git log. It covers the situations where git reset causes real damage and the habits that prevent it. There are two main risks. Rewriting history that other people already have is o7 min readinit, add, commit, status, and log. It also assumes you know how git reset moves the branch, the index, and the working directory in its --soft, --mixed, and --hard modes. Here you will compare reset with two other commands that undo work, `git reve7 min readgit reset modes, --keep and --merge. It assumes you know --soft, --mixed, and --hard from the earlier chapters. You should also be comfortable reading git status --short and know that an index entry is a file's staged version.6 min read