Let's check the status when an existing file is modified. Stage So our next stage is to add our files to the staging area: git add blah. git status The output of this command not only tells you the stage of the files in your repository but also gives you some handy tips on what to do next. staged: changes that will be included in the next commit We use git add to add changes to the staging area. We can see that the current status after committing the file is clean as it was before. Git-status is used to understand what stage the files in a repository are at. Let's commit it and then check the status. The status output does not show any information about the committed project history. It makes it possible to view the staged changes and the files not being tracked by Git. staged and -cached does not point to HEAD, just difference with respect to HEAD. staged changes) against the current HEAD. This command will help us to avoid the changes that we don't want to commit. The git status command is run to show the state of the working directory and the staging area. -cached means show the changes in the cache/index (i.e. Staging area is files that are going to be a part of the next commit, which lets git know what changes in. Consider the below output:įrom the above output, we can see that the status after staging the file is showing as " changes to be committed".īefore committing blindly, we can check the status. These files are also referred to as untracked files. Let's track the file and will see the status after adding a file to the repository. As in the above output, it is suggesting to use the add command to track the file. The status command also displays the suggestions. Consider the below output:Īs we can see from the above output, the status is showing as " nothing added to commit but untracked files present (use "git add" to track)". Changes not staged for commit are also modifications in your local files - but ones that you havent added to the staging area, yet. Now, check the status using the status command. Issue the git status command and inspect the results. Add a new file named index.html to the repository. Issue the git status command and note the results. Let's create a file using the touch command. To really learn how to use the Git status command, follow these steps: Issue a git init command to create a new repository. When we create a file in the repository, the state of the repository changes. Since there is nothing to track or untrack in the working tree, so the output is showing as the working tree is clean.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |