Git Reference Flashcards
What is git?
Git is a distributed version control system that allows you to track the changes made to a project over time.
How do we start tracking the changes in a new project?
execute the “git init” command in the root of your project directory.
What are the three parts of a git project?
- The working directory where you will be doing all your work.
- The staging area where you list all the changes you have made to the working directory.
3.The repository where git permanently stores the changes as different versions of the project.
Command:
git status
git status will give three main categories of information.
1. changes made to files in the working directory but not yet staged for commit.
2. changes that have been staged and will be included in the next commit.
3. files in your working directory that are detected by git but are not being tracked.
Command:
git add
This will add the file(s) to the staging area any changes will be tracked.
Command:
git diff <file_name></file_name>
This will show the difference between the file in the working directory and the version in the staging area.
Command:
git commit -m “Complete first line of dialogue”
This is the final step in the git work flow. ‘git commit’ will permanently store the changes in the staging area to the git repository.
Note. -m adds a message describing the commit. this should be kept 50 characters and present tense.
Command:
git log
This will return a chronological list of all the commits in the current repository.