Git Basics Flashcards
What kind of program is Git?
Git is a version control system.
What are the differences between Git and a text editor in terms of what they save and their record keeping?
Git: Saves differences in files and folders and keeps all historical versions.
Text Editor: Only one version of the file.
Does Git work at a local or remote level?
The local level.
Does GitHub work at a local or remote level?
The remote level.
Why is Git useful for an individual developer?
Allows to historically track why/when individual developer did what they did with code
Why are Git and GitHub useful for a team of developers?
Allows the team to collaborate with one another and see who changed a file and why they changed a file
How do you create a new repository on GitHub?
Press the + button next to the profile icon and click on new repository.
How do you copy a repository onto your local machine from GitHub?
‘git clone git@github.com:USER-NAME/REPOSITORY-NAME.git’.
What is the default name of your remote connection?
Origin
Explain what origin is in git push origin main.
Origin is the name of the remote repository that the main branch is being merged to.
Explain what main is in git push origin main.
Main is the default branch of the file’s respective local repository.
Explain the two-stage system that Git uses to save files.
git add file-name: Places the file in a ‘waiting room’ with the changes made to the file.
git commit file-name: Approves the file so it can be pushed out and copied remotely.
How do you check the status of your current repository?
‘git status’.
How do you add files to the staging area in git?
‘git add .’ if you have multiple files to add.
‘git add file-name’ if you have a single file to add.
How do you commit the files in the staging area and add a descriptive message?
‘git commit -m “Your message here.” ‘
How do you push your changes to your repository on GitHub?
‘git push’ if you only have a main branch
‘git push origin branch-name’ if you’re working off another branch
How do you look at the history of your previous commits?
‘git log’
What are two benefits of having well-written commit messages and a good commit history?
- It establishes consistent and concise communication to you and your team
- Helps maintain the project log and the team is able to see who worked on what changes
How many characters should the subject line of your commit message be?
Around 50 characters but no more than 72.