In the next tutorial we will learn to commit the changes that were added to the staging area. To unstage all staged files use git reset command without filename. Now, if we run the git status command it will show js/ as untracked. If we want to unstage lets say default.js file which is inside the js folder we will use the following command. To unstage a file that was staged using the git add command we use the git reset command. Now, the git status command will show us all the files that are staged. ![]() To stage the js directory we will run the following command. In the above output we can see that we have js/ directory that is untracked. Now if we run the git status command we will see untracked files and staged file index.php the one we added earlier. Now, lets create a js directory inside the project folder and add a default.js file inside it. Now if we run the git status command we will see that the index.php file is staged and ready to be committed. To add a change in a file to the staging area we use git add command. Untracked files: A file that is not yet staged or committed. So, the output tells us that there are some untracked files. Nothing added to commit but untracked files present (use "git add" to track) Now, if we run the git status command we will get an untracked file. Now we will create a new file index.php inside the project folder using touch index.php command. Nothing to commit (create/copy files and use "git add" to track)įrom the above output we can easily tell that we are on the master branch and there is nothing to commit. Going back to our git-project that we created in the previous tutorial, if we run the git status command we will get the status of the Git repository. If we want to stage (add) all changes in the working directory we use. If we want to stage (add) all changes in a directory we pass the directory path. If we want to stage (add) all changes in a file we pass the file path. We use the git add command when we want to add the changes in the working directory to the staging area.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |