Introduction Flashcards
what is git?
- content tracker - tracks all the changes to the code
- Distributed version control system
what is a version control system?
Version control system means, you can go back in time to a previous version of the code since git stored it all
Why do we say DISTRIBUTED version control system?
DISTRIBUTED because, we will have a remote repository which will be stored in a server and a local repository which will be stored in the local machine of every developer.
Every developer has full copy of code base
What are the two repositories git has?
Local and Remote
Remote repository is usually a centralized server
When is a remote repository really useful?
When you want to take a backup of your code and when you are working as a team
What are the different stages in local repository?
The local repository actually consists of three stages. The working area, where all your active changes. Git doesn’t know what to do with them yet, it
just knows that these files contain some
updates.
The staging area contains new
changes that will soon be committed,
and then there are the committed files.
How is version control added to the project?
By adding commits
What is the procedure to commit?
The files that should be included in the
commit are first added to the staging area. A
commit gets created when a developer
actually commits those files.
for debian based distros, how do we install a package?
apt get
eg. sudo apt install git-all
How to initialize a a git repo?
git init
How does git know all of your changes and files?
Although we haven’t done anything with Git
yet, we initialized a Git repository in this
project/directory. so Git knows all of our files and their
changes.
What is committing in Git repository?
Storing changes in a local Git repository is called committing. With every commit, we save the current state of the repository
What are untracked files in the output of git status?
Untracked files. These are the files that Git
knows of. However, we haven’t told Git what
to do with them. We haven’t told it yet that
we want to add it to our local repository. Eg. Right now, we haven’t told Git what to do with the new
story1 .txt file. It might be that we don’t want
to add that story to our local repository at all.
What are the different areas in the local git repository?
- Working area
2.staging area - committed files area
Before committing a file, which area should you put the file in?
Staging area using the git add command