This guide is to show basic commands and processes for utilizing a Local Git Repo. We will go over the following processes:
- How to initialize git
- How to check the status of files in the git
- How to stage files
- How to commit files
To initialize a local Git repo, follow the below steps
- Open the terminal
- Navigate to the folder for your repo
- run the command git init**
To check the status of the files in your Git repo to see if they need to be updated/added, use the git status
command.
To add a file to staging, use the command git add [file_name_and_extension]
Once the files have been added to staging, you can now Commit the changes to the Git repo. If we had a file called sample.txt in staging that we needed to commit, we will use the git commit
command. This command should NEVER** be run without the -m extension, which will add a comment to the commit. The first time committing will always look like this: git commit -m 'Initial commit'
which tells us that this is the very first commit to this repo.
Below is an example of what it would look like to use these commands:
```
cd git_practice
git init
git status
git add 'file1.txt'
git add 'file2.txt'
git commit -m 'Initial commit'
```