main. You can do so by running:
git config --global init.defaultBranch main
git clonefollowed by the URL you copied in the last step. The full command should look similar to
git clone [email protected]:USER-NAME/REPOSITORY-NAME.git.
cdinto the new git_test folder that was downloaded and then enter
git remote -vin your command line. This will display the URL of the repository you created in GitHub, which is the remote for your local copy. You may have also noticed the word origin at the start of the
git remote -voutput, which is the name of your remote connection. The name "origin" is both the default and the convention for the remote repository, but it could have just as easily been named "party-parrot" or "dancing-banana". (Don't worry about the details of origin for now; it will come up again near the end of this tutorial.)
git_testfolder called "README.md" with the command
git statusin your terminal. In the output, notice that your README.md file is shown in red, which means that this file is not staged.
git add README.md. This command adds your README.md file to the staging area in Git. Now, type
git statusagain. In the output, notice that your file is now shown in green, which means that this file is now in the staging area.
git commit -m "Add README.md"and then type
git statusonce more. The output should now say, "nothing to commit, working tree clean", indicating that your changes have been committed.
git logand look at the output. You should see an entry for your "Add README.md" commit. You will also see details on the author who made the commit and the date and time for when the commit was made.
hello_world.txt. In the terminal, type
git status, and notice
hello_world.txtis not staged.
git status, and notice that README.md is now shown as modified, and not staged or committed. This is because you made a change to it, and it is already a tracked file.
git add README.md.
git statuswill output now? README.md will be displayed in green text, while hello_world.txt will still be in red. This means that only README.md has been added to the staging area.
git add ., where the full stop means to add all files in the current directory that are not staged. Then, type
git statusonce more, and everything should now be in the staging area. (Note: You can use
git add -Ato add ALL unstaged files to the staging area within the repository)_
git commit -m "Add hello_world.txt and edit README.md". Then, type
git statusonce again, which will output "nothing to commit".
git log. You should now see two entries.
git push origin main.
git statusone final time. It should output "nothing to commit, working tree clean".