Those are referred to as the ‘bare double dashes’, and they prevent ambiguity by ensuring that we’re resetting a file and not specifying a branch. No changes added to commit (use "git add" and/or "git commit -a")Īnd our changes are left intact but removed from the staging area! Mission accomplished! However, you might be wondering about the strange - that shows up in the command. # (use "git checkout - \." to discard changes in working directory) # (use "git add \." to update what will be committed) Let’s give it a shot! $ git reset - example.txt This means that git reset defaults to HEAD, so we can leave that bit out. (It does not affect the working tree, nor the current branch.) This form resets the index entries for all. Hey, that’s neat - it tells us right there how to unstage files! This is accomplished using the git reset command. Let’s look at an example case - running git status after staging a file might look like this: $ git add example.txt Often I’ll be working and adding files to the staging area with git add, and then decide (for example), that I don’t want to commit some files with the others and get them out of the staging area (but keep my work intact). I wanted to share a handy alias I use for removing files from the staging area in git. If you want to jump straight to the good stuff, click here. This post dives a bit into the git reset command.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |