![]() If you want to stage all modified files as well as all untracked files, then do: However you can use the following to stage all modified files: In which case, it can get tedious to stage them one-by-one. There will be times when you have a lot of modified files that you want staged. We need to do a git "push" to get our commit uploaded. Note, at this point, our commit is only stored on our local workstation. Nothing to commit (working directory puppetlabs-ntp]$ # Your branch is ahead of 'origin/master' by 1 commit. # new file: puppetlabs-ntp]$ git commit -m "this is a demo"Ģ files changed, 2 insertions(+), 0 deletions(-)Ĭreate mode 100644 puppetlabs-ntp]$ git status Let's now follow the above instructions to stage these 2 puppetlabs-ntp]$ git add puppetlabs-ntp]$ git add puppetlabs-ntp]$ git status No changes added to commit (use "git add" and/or "git commit puppetlabs-ntp]$ git status If we now go ahead and do a commit, you'll discover from git's status that nothing has actually happened, since nothing has been put into puppetlabs-ntp]$ git commit " to include in what will be committed)Īs you can see, git has also discovered this new file, and is marked it as a an untracked file, along with how to get this filed as tracked-staged so to have it included in the next commit. Now let's create a new file that is going to be part of the puppetlabs-ntp]$ echo "hello" > puppetlabs-ntp]$ git status No changes added to commit (use "git add" and/or "git commit puppetlabs-ntp]$Īs you can see we also get prompts on how to stage this file in order to be included in the next commit. ![]() " to discard changes in working directory) ![]() This results in the files from the previous commit being overlayed with the newly staged files in order to create a new snapshot (aka commit).Īnother thing you may want to do is remove a tracked file from the project. | ->|Īfter that, once you are happy with everything, you then take a snapshot using git’s “commit” command. | Add new files to be included in the next commit | You also use git’s “add” command to have new files “staged” so that they are included in the the next commit: If you edit any of these files (e.g using a text editor such as vim), then these file’s state changes to “modified”Īt this stage, if you do a git “commit”, the edited file will not get committed, that’s because modified files first needs to be “staged” in order to be included in the next commit. Now if you clone a git repo, then all the project files start off in the “unmodified” state In the case of cloning an exisiting git repo You can change the state of these files to “tracked – staged” by using git’s “add” command git isn’t of the existance of these files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |