9/11/2023 0 Comments Git restore headNote that git diff can also be useful to check the state of things. " to unstage)Īs we can see from our output, we have a commit history reflecting three commits, along with one staged file sitting in the staging index. Next, let's make one more change to file1.ext and only stage the changes (but not commit), then we'll run a git log followed by a git status to check out the state of things: $ git log -oneline We'll take a closer look at all three, but first let's create a basic Git repo with the following structure and show a simple git reset command in action: git-reset-example/Īssuming we have already made our initial commit, let's add some text to file1.ext and dir1file1.ext and stage and commit them both in separate commits. The default option is git reset -mixed, which updates the current branch tip and moves anything in the staging area back to the working directory. Note that each branch head points to the tip of that branch, i.e. When git reset is run without specifying a commit, it is typically to undo changes in Git's staging area or working directory (or both), without resetting the branch to a different commit. ![]() Since Git HEAD always points to the currently checked out commit, the current branch tip is not repointed or changed in this case. This is equivalent to running the command "git reset HEAD". When the parameter is omitted, it defaults to the commit pointed to by Git HEAD.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |