While completing group projects at The Flatiron school I had some serious commitment phobia when it came to GitHub. I was so afraid my changes were not being saved, or that something would go wrong and my work would be ruined.
Over the last week though I've worked through that fear by making quite a few commits.
Last week I blogged about how to create a repository from the command line and today I will take you through the steps to add files to your repository and update already existing files in your repository.
Step 1: Adding/Staging a new file to your repository
Using the command git add
you can stage local files to an existing repository. staging a file means preparing the file for a commit.
git add.
will stage all local directory files. You can stage individual files from your directory by using git add filename.ext
instead of git add.
Step 2: Commit and Comment on Changes
Using the command git commit -m "comment"
allows you to commit the file or files you staged in step 1. the -m
allows you to leave a comment on the changes made. It is important to comment on your commits so that you leave a trail of changes to your files.
Step 3: Push the changes to the repository
Using the command git push
you will push your changes to the repository.
It really is easy as 1-2-3.
Top comments (0)